User:Sudhiksha v/bookmarks.js

// Define an object to store bookmarked pages let bookmarks = {};

// Function to add a bookmark function addBookmark(pageName, url) { bookmarks[pageName] = url; }

// Function to remove a bookmark function removeBookmark(pageName) { delete bookmarks[pageName]; }

// Function to check if a page is bookmarked function isBookmarked(pageName) { return bookmarks.hasOwnProperty(pageName); }

// Function to get the URL of a bookmarked page function getBookmarkURL(pageName) { return bookmarks[pageName]; }

// Example usage: addBookmark("Home", "https://www.example.com"); addBookmark("Contact", "https://www.example.com/contact");

console.log("Bookmarks:", bookmarks); console.log("Is 'Home' bookmarked?", isBookmarked("Home")); console.log("Is 'About' bookmarked?", isBookmarked("About")); console.log("URL of 'Home' bookmark:", getBookmarkURL("Home"));

removeBookmark("Home"); console.log("Bookmarks after removing 'Home':", bookmarks);