{"id":564,"date":"2025-05-19T10:51:12","date_gmt":"2025-05-19T10:51:12","guid":{"rendered":"https:\/\/buhave.com\/courses\/?p=564"},"modified":"2025-05-20T12:57:38","modified_gmt":"2025-05-20T12:57:38","slug":"advanced-javascript-concepts","status":"publish","type":"post","link":"https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/","title":{"rendered":"Advanced JavaScript Concepts"},"content":{"rendered":"<h2>Callbacks, Promises, and async\/await<\/h2>\n<p>Handling asynchronous operations is essential in JavaScript, especially for tasks like fetching data from a server, reading files, or setting timers. JavaScript provides Callbacks, Promises, and async\/await to manage asynchronous behavior efficiently.<\/p>\n<h3>Callbacks<\/h3>\n<p>A callback is simply a function passed into another function as an argument, which is then invoked inside the outer function.<\/p>\n<p style=\"text-align: center\"><em>function fetchData(callback) {<\/em><br \/>\n<em>setTimeout(() =&gt; {<\/em><br \/>\n<em>callback(&#8216;Data received!&#8217;);<\/em><br \/>\n<em>}, 2000);<\/em><br \/>\n<em>}<\/em><\/p>\n<p style=\"text-align: center\"><em>fetchData(function(data) {<\/em><br \/>\n<em>console.log(data); \/\/ Output after 2 seconds: Data received!<\/em><br \/>\n<em>});<\/em><\/p>\n<p><strong>Problems with Callbacks:<\/strong><\/p>\n<ul>\n<li>Callback Hell: Deep nesting of callbacks.<\/li>\n<li>Harder to read and maintain.<\/li>\n<li>Difficult to handle errors properly.<\/li>\n<\/ul>\n<h3>Promises<\/h3>\n<p>A Promise represents a value that may be available now, later, or never. It&#8217;s an object with three states:<\/p>\n<ul>\n<li>Pending \u2013 operation is ongoing.<\/li>\n<li>Fulfilled \u2013 operation completed successfully.<\/li>\n<li>Rejected \u2013 operation failed.<\/li>\n<\/ul>\n<p style=\"text-align: center\"><em>const fetchData = new Promise((resolve, reject) =&gt; {<\/em><br \/>\n<em>setTimeout(() =&gt; {<\/em><br \/>\n<em>resolve(&#8216;Data received!&#8217;);<\/em><br \/>\n<em>}, 2000);<\/em><br \/>\n<em>});<\/em><\/p>\n<p style=\"text-align: center\"><em>fetchData.then(data =&gt; {<\/em><br \/>\n<em>console.log(data);<\/em><br \/>\n<em>}).catch(error =&gt; {<\/em><br \/>\n<em>console.error(error);<\/em><br \/>\n<em>});<\/em><\/p>\n<p><strong>Advantages of Promises:<\/strong><\/p>\n<ul>\n<li>Cleaner syntax.<\/li>\n<li>Easy error handling with .catch().<\/li>\n<li>Chaining with .then().<\/li>\n<\/ul>\n<h3>Async\/Await<\/h3>\n<p>async\/await is syntactic sugar built on top of Promises, making asynchronous code look synchronous and easier to write.<\/p>\n<ul>\n<li>Async makes a function return a Promise.<\/li>\n<li>Await pauses the execution of an async function until the Promise is resolved.<\/li>\n<\/ul>\n<p style=\"text-align: center\"><em>async function fetchData() {<\/em><br \/>\n<em>try {<\/em><br \/>\n<em>const data = await new Promise((resolve) =&gt; {<\/em><br \/>\n<em>setTimeout(() =&gt; resolve(&#8216;Data received!&#8217;), 2000);<\/em><br \/>\n<em>});<\/em><br \/>\n<em>console.log(data);<\/em><br \/>\n<em>} catch (error) {<\/em><br \/>\n<em>console.error(error);<\/em><br \/>\n<em>}<\/em><br \/>\n<em>}<\/em><\/p>\n<p style=\"text-align: center\"><em>fetchData();<\/em><\/p>\n<p><strong>Advantages of async\/await:<\/strong><\/p>\n<ul>\n<li>More readable and straightforward code.<\/li>\n<li>Better error handling with try&#8230;catch.<\/li>\n<li>Easier to maintain and debug.<\/li>\n<\/ul>\n<p><strong>Quick Summary:<\/strong><\/p>\n<ul>\n<li>Callbacks: First way to handle async tasks but can lead to messy code.<\/li>\n<li>Promises: Provide better structure and error handling.<\/li>\n<li>async\/await: Simplifies writing and understanding asynchronous code.<\/li>\n<\/ul>\n<h2>Error handling with try&#8230;catch<\/h2>\n<p>JavaScript provides the try&#8230;catch statement to gracefully handle errors that might occur during code execution without crashing the program.<\/p>\n<h3>How try&#8230;catch Works<\/h3>\n<ul>\n<li>Try block: You place the code that may throw an error inside the try block.<\/li>\n<li>Catch block: If an error occurs in the try block, the catch block will execute, allowing you to handle the error.<\/li>\n<\/ul>\n<p style=\"text-align: center\"><em>try {<\/em><br \/>\n<em>let result = riskyFunction();<\/em><br \/>\n<em>console.log(result);<\/em><br \/>\n<em>} catch (error) {<\/em><br \/>\n<em>console.error(&#8216;An error occurred:&#8217;, error.message);<\/em><br \/>\n<em>}<\/em><\/p>\n<p>If riskyFunction() throws an error, JavaScript jumps to the catch block and runs the code inside it.<\/p>\n<p><strong>Error Object<\/strong><\/p>\n<ul>\n<li>In the catch(error) block, the error object contains:<\/li>\n<li>Name: Type of the error (e.g., ReferenceError, TypeError).<\/li>\n<li>Message: Human-readable description of the error.<\/li>\n<li>Stack: Stack trace (useful for debugging).<\/li>\n<\/ul>\n<p><strong>Example:<\/strong><\/p>\n<p style=\"text-align: center\"><em>try {<\/em><br \/>\n<em>let x = y + 1; \/\/ y is not defined<\/em><br \/>\n<em>} catch (err) {<\/em><br \/>\n<em>console.log(err.name); \/\/ ReferenceError<\/em><br \/>\n<em>console.log(err.message); \/\/ y is not defined<\/em><br \/>\n<em>}<\/em><\/p>\n<p><strong>Optional finally Block<\/strong><\/p>\n<p>You can add a finally block after try&#8230;catch, which always runs, whether an error occurred or not \u2014 useful for cleanup tasks.<\/p>\n<p style=\"text-align: center\"><em>try {<\/em><br \/>\n<em>\/\/ risky code<\/em><br \/>\n<em>} catch (error) {<\/em><br \/>\n<em>console.error(error);<\/em><br \/>\n<em>} finally {<\/em><br \/>\n<em>console.log(&#8216;This always runs.&#8217;);<\/em><br \/>\n<em>}<\/em><\/p>\n<p><strong>Common Use Cases for try&#8230;catch<\/strong><\/p>\n<ul>\n<li>Handling network errors (fetch failures)<\/li>\n<li>Parsing JSON data (JSON.parse)<\/li>\n<li>File operations (in Node.js)<\/li>\n<li>Validating user input<\/li>\n<li>Preventing app crashes due to minor errors<\/li>\n<\/ul>\n<p><strong>Quick Summary:<\/strong><\/p>\n<ul>\n<li>Wrap risky code inside try.<\/li>\n<li>Handle exceptions in catch.<\/li>\n<li>Use finally for code that must run regardless of errors.<\/li>\n<li>Try&#8230;catch improves app stability, debugging, and user experience.<\/li>\n<\/ul>\n<h2>Event Bubbling and Delegation<\/h2>\n<h3>What is Event Bubbling?<\/h3>\n<p>Event bubbling happens when an event on a specific element starts there and bubbles up through its parent elements in the DOM hierarchy.<\/p>\n<p>It allows parent elements to react to events fired by their children, unless the bubbling is stopped.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p style=\"text-align: center\"><em>&lt;div id=&#8221;parent&#8221;&gt;<\/em><br \/>\n<em>&lt;button id=&#8221;child&#8221;&gt;Click Me&lt;\/button&gt;<\/em><br \/>\n<em>&lt;\/div&gt;<\/em><\/p>\n<p style=\"text-align: center\"><em>document.getElementById(&#8216;child&#8217;).addEventListener(&#8216;click&#8217;, () =&gt; {<\/em><br \/>\n<em>console.log(&#8216;Child clicked&#8217;);<\/em><br \/>\n<em>});<\/em><\/p>\n<p style=\"text-align: center\"><em>document.getElementById(&#8216;parent&#8217;).addEventListener(&#8216;click&#8217;, () =&gt; {<\/em><br \/>\n<em>console.log(&#8216;Parent clicked&#8217;);<\/em><br \/>\n<em>});<\/em><\/p>\n<p><strong>When the button is clicked:<\/strong><\/p>\n<ul>\n<li>First, Child clicked logs.<\/li>\n<li>Then, Parent clicked logs because the event bubbles up to the parent.<\/li>\n<\/ul>\n<p><strong>Stopping Event Bubbling<\/strong><\/p>\n<p>You can prevent the event from reaching parent elements using event.stopPropagation():<\/p>\n<p style=\"text-align: center\"><em>document.getElementById(&#8216;child&#8217;).addEventListener(&#8216;click&#8217;, (event) =&gt; {<\/em><br \/>\n<em>event.stopPropagation();<\/em><br \/>\n<em>console.log(&#8216;Child clicked, bubbling stopped&#8217;);<\/em><br \/>\n<em>});<\/em><\/p>\n<p>Now only the child&#8217;s message will log.<\/p>\n<h3>What is Event Delegation?<\/h3>\n<ul>\n<li>Event delegation is a pattern where one event listener is attached to a parent element.<\/li>\n<li>The parent catches events that bubble up from children, even if children are added dynamically.<\/li>\n<\/ul>\n<p><strong>Example:<\/strong><\/p>\n<p style=\"text-align: center\"><em>document.getElementById(&#8216;parent&#8217;).addEventListener(&#8216;click&#8217;, (event) =&gt; {<\/em><br \/>\n<em>if (event.target.tagName === &#8216;BUTTON&#8217;) {<\/em><br \/>\n<em>console.log(&#8216;Button clicked:&#8217;, event.target.textContent);<\/em><br \/>\n<em>}<\/em><br \/>\n<em>});<\/em><\/p>\n<p>This way, you don&#8217;t need to individually add event listeners to each button.<\/p>\n<p><strong>Benefits of Event Delegation<\/strong><\/p>\n<ul>\n<li>Better Performance: Fewer event listeners on the page.<\/li>\n<li>Dynamic Content Handling: New elements automatically work without extra code.<\/li>\n<li>Simplified Code: Easier maintenance and upgrades.<\/li>\n<\/ul>\n<p><strong>Quick Recap:<\/strong><\/p>\n<ul>\n<li>Event Bubbling = Events rise from the target to the top.<\/li>\n<li>Event Delegation = Listen at a higher level to handle multiple child events smartly.<\/li>\n<\/ul>\n<h2>JSON and localStorage<\/h2>\n<h3>What is JSON?<\/h3>\n<ul>\n<li>JSON stands for JavaScript Object Notation.<\/li>\n<li>It is a lightweight data format used for storing and exchanging data between a server and a client.<\/li>\n<li>JSON is easy to read and write for both humans and machines.<\/li>\n<li>It looks like JavaScript objects but only supports text (no functions, no methods).<\/li>\n<\/ul>\n<p><strong>Example JSON:<\/strong><\/p>\n<p style=\"text-align: center\"><em>{<\/em><br \/>\n<em>&#8220;name&#8221;: &#8220;Alice&#8221;,<\/em><br \/>\n<em>&#8220;age&#8221;: 25,<\/em><br \/>\n<em>&#8220;isStudent&#8221;: true<\/em><br \/>\n<em>}<\/em><\/p>\n<p><strong>Working with JSON in JavaScript<\/strong><\/p>\n<p><strong>Convert an object to JSON string (serialization):<\/strong><\/p>\n<p style=\"text-align: center\"><em>const user = { name: &#8220;Alice&#8221;, age: 25 };<\/em><br \/>\n<em>const jsonString = JSON.stringify(user);<\/em><br \/>\n<em>console.log(jsonString); \/\/ &#8216;{&#8220;name&#8221;:&#8221;Alice&#8221;,&#8221;age&#8221;:25}&#8217;<\/em><\/p>\n<p><strong>Convert JSON string back to object (deserialization):<\/strong><\/p>\n<p style=\"text-align: center\"><em>const parsedUser = JSON.parse(jsonString);<\/em><br \/>\n<em>console.log(parsedUser.name); \/\/ &#8216;Alice&#8217;<\/em><\/p>\n<h3>What is localStorage?<\/h3>\n<ul>\n<li>localStorage is a web storage API that allows you to store data in the browser.<\/li>\n<li>It persists even after the page is refreshed or the browser is closed.<\/li>\n<li>Data is stored as key-value pairs and always as strings.<\/li>\n<\/ul>\n<p><strong>Basic localStorage methods:<\/strong><\/p>\n<ul>\n<li>setItem(key, value): Store data<\/li>\n<li>getItem(key): Retrieve data<\/li>\n<li>removeItem(key): Remove a specific item<\/li>\n<li>clear(): Remove all data<\/li>\n<\/ul>\n<p><strong>Storing and Retrieving JSON with localStorage<\/strong><\/p>\n<p>Since localStorage only stores strings, you usually stringify objects before storing and parse them after retrieving:<\/p>\n<p style=\"text-align: center\"><em>\/\/ Saving an object<\/em><br \/>\n<em>const settings = { theme: &#8220;dark&#8221;, fontSize: 14 };<\/em><br \/>\n<em>localStorage.setItem(&#8220;userSettings&#8221;, JSON.stringify(settings));<\/em><\/p>\n<p style=\"text-align: center\"><em>\/\/ Getting and parsing the object<\/em><br \/>\n<em>const savedSettings = JSON.parse(localStorage.getItem(&#8220;userSettings&#8221;));<\/em><br \/>\n<em>console.log(savedSettings.theme); \/\/ &#8216;dark&#8217;<\/em><\/p>\n<p><strong>Key Points to Remember<\/strong><\/p>\n<ul>\n<li>Always use JSON.stringify() before saving objects\/arrays to localStorage.<\/li>\n<li>Always use JSON.parse() after retrieving them.<\/li>\n<li>localStorage is synchronous (can block the main thread if overused).<\/li>\n<li>Storage limit is usually around 5MB per domain.<\/li>\n<\/ul>\n<p><strong>Quick Recap:<\/strong><\/p>\n<ul>\n<li>JSON: Lightweight text format for data.<\/li>\n<li>localStorage: Browser-based storage that persists data across sessions.<\/li>\n<li>Together, they allow easy saving and loading of structured data!<\/li>\n<\/ul>\n<h2>Module systems (ES Modules)<\/h2>\n<p><strong>What are ES Modules (ESM)?<\/strong><\/p>\n<p>ES Modules (or ESM) are the official module system introduced in JavaScript to enable the organization and reuse of code.<\/p>\n<p>Prior to ESM, JavaScript used CommonJS and other formats like AMD for modules, but ESM provides a native, modern, and standardized way of working with modules in JavaScript.<\/p>\n<p><strong>Features of ES Modules<\/strong><\/p>\n<ul>\n<li>Importing and Exporting: You can use import to bring in code from other files, and export to make parts of your code available to other files.<\/li>\n<li>Static Import: ES Modules use static imports, which means the dependencies are resolved at compile-time, allowing for better performance and optimizations.<\/li>\n<\/ul>\n<h3>Importing and Exporting in ES Modules<\/h3>\n<p><strong>1. Exporting Functions, Variables, and Objects<\/strong><\/p>\n<ul>\n<li>Named Export: Export individual functions, variables, or objects.<\/li>\n<\/ul>\n<p style=\"text-align: center\"><em>\/\/ module.js<\/em><br \/>\n<em>export const name = &#8216;Alice&#8217;;<\/em><br \/>\n<em>export function greet() {<\/em><br \/>\n<em>console.log(&#8216;Hello, &#8216; + name);<\/em><br \/>\n<em>}<\/em><\/p>\n<ul>\n<li>Default Export: Export a single entity (like a function or object) from the module.<\/li>\n<\/ul>\n<p style=\"text-align: center\"><em>\/\/ utils.js<\/em><br \/>\n<em>export default function sum(a, b) {<\/em><br \/>\n<em>return a + b;<\/em><br \/>\n<em>}<\/em><\/p>\n<p><strong>2. Importing in Other Files<\/strong><\/p>\n<ul>\n<li>Named Import: Import specific exports from a module.<\/li>\n<\/ul>\n<p style=\"text-align: center\"><em>\/\/ app.js<\/em><br \/>\n<em>import { name, greet } from &#8216;.\/module.js&#8217;;<\/em><br \/>\n<em>console.log(name); \/\/ Alice<\/em><br \/>\n<em>greet(); \/\/ Hello, Alice<\/em><\/p>\n<ul>\n<li>Default Import: Import the default export from a module.<\/li>\n<\/ul>\n<p style=\"text-align: center\"><em>\/\/ app.js<\/em><br \/>\n<em>import sum from &#8216;.\/utils.js&#8217;;<\/em><br \/>\n<em>console.log(sum(2, 3)); \/\/ 5<\/em><\/p>\n<ul>\n<li>Import All: Import everything from a module as a single object.<\/li>\n<\/ul>\n<p style=\"text-align: center\"><em>\/\/ app.js<\/em><br \/>\n<em>import * as utils from &#8216;.\/utils.js&#8217;;<\/em><br \/>\n<em>console.log(utils.sum(2, 3)); \/\/ 5<\/em><\/p>\n<p><strong>How to Use ES Modules in the Browser<\/strong><\/p>\n<ul>\n<li>In browsers, you can use modules by adding the type=&#8221;module&#8221; attribute to the &lt;script&gt; tag.<\/li>\n<li>This allows you to use import and export directly in the browser without any bundling.<\/li>\n<\/ul>\n<p style=\"text-align: center\"><em>&lt;script type=&#8221;module&#8221;&gt;<\/em><br \/>\n<em>import { greet } from &#8216;.\/module.js&#8217;;<\/em><br \/>\n<em>greet();<\/em><br \/>\n<em>&lt;\/script&gt;<\/em><\/p>\n<p><strong>ES Modules in Node.js<\/strong><\/p>\n<ul>\n<li>ESM in Node.js: Node.js started supporting ES Modules natively starting from version 12.<\/li>\n<li>You can use .mjs file extension for modules or set &#8220;type&#8221;: &#8220;module&#8221; in the package.json.<\/li>\n<\/ul>\n<p style=\"text-align: center\"><em>\/\/ In package.json<\/em><br \/>\n<em>{<\/em><br \/>\n<em>&#8220;type&#8221;: &#8220;module&#8221;<\/em><br \/>\n<em>}<\/em><\/p>\n<p><strong>Dynamic Imports<\/strong><\/p>\n<ul>\n<li>You can also load modules dynamically using the import() function, which returns a Promise.<\/li>\n<\/ul>\n<p style=\"text-align: center\"><em>import(&#8216;.\/module.js&#8217;)<\/em><br \/>\n<em>.then(module =&gt; {<\/em><br \/>\n<em>module.greet();<\/em><br \/>\n<em>})<\/em><br \/>\n<em>.catch(err =&gt; console.error(err));<\/em><\/p>\n<p><strong>Advantages of ES Modules<\/strong><\/p>\n<ul>\n<li>Better code organization: Modularize code for easier maintenance and reuse.<\/li>\n<li>Built-in support: Native to modern browsers and Node.js, so you don\u2019t need extra tools.<\/li>\n<li>Performance benefits: Static imports help the JavaScript engine optimize loading and execution.<\/li>\n<\/ul>\n<p><strong>Quick Recap<\/strong><\/p>\n<ul>\n<li>ES Modules (ESM) are the standard way to handle modules in JavaScript.<\/li>\n<li>They allow importing and exporting functions, variables, and objects between different files.<\/li>\n<\/ul>\n<p>Supported natively in browsers and Node.js, making them a versatile and powerful tool for structuring code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Callbacks, Promises, and async\/await Handling asynchronous operations is essential in JavaScript, especially for tasks like fetching data from a server, reading files, or setting timers. JavaScript provides Callbacks, Promises, and async\/await to manage asynchronous behavior efficiently. Callbacks A callback is simply a function passed into<\/p>\n","protected":false},"author":1,"featured_media":565,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-564","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java-script"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Advanced JavaScript Concepts - Java Script Course<\/title>\n<meta name=\"description\" content=\"Advanced JavaScript concepts delve into closures, asynchronous programming, inheritance, and patterns for efficient, structured code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Advanced JavaScript Concepts - Java Script Course\" \/>\n<meta property=\"og:description\" content=\"Advanced JavaScript concepts delve into closures, asynchronous programming, inheritance, and patterns for efficient, structured code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/\" \/>\n<meta property=\"og:site_name\" content=\"BUHAVE\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/BeYouHave\/\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/naveedsafdarawan\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-19T10:51:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-20T12:57:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/04\/Advanced-JavaScript-Concepts.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Naveed Safdar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Naveed Safdar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/advanced-javascript-concepts\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/advanced-javascript-concepts\\\/\"},\"author\":{\"name\":\"Naveed Safdar\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#\\\/schema\\\/person\\\/04fe0254e118521c9fbb3da39de5acca\"},\"headline\":\"Advanced JavaScript Concepts\",\"datePublished\":\"2025-05-19T10:51:12+00:00\",\"dateModified\":\"2025-05-20T12:57:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/advanced-javascript-concepts\\\/\"},\"wordCount\":1540,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/advanced-javascript-concepts\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/buhave.com\\\/courses\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/Advanced-JavaScript-Concepts.webp\",\"articleSection\":[\"Java Script Course\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/advanced-javascript-concepts\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/advanced-javascript-concepts\\\/\",\"url\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/advanced-javascript-concepts\\\/\",\"name\":\"Advanced JavaScript Concepts - Java Script Course\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/advanced-javascript-concepts\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/advanced-javascript-concepts\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/buhave.com\\\/courses\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/Advanced-JavaScript-Concepts.webp\",\"datePublished\":\"2025-05-19T10:51:12+00:00\",\"dateModified\":\"2025-05-20T12:57:38+00:00\",\"description\":\"Advanced JavaScript concepts delve into closures, asynchronous programming, inheritance, and patterns for efficient, structured code.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/advanced-javascript-concepts\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/advanced-javascript-concepts\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/advanced-javascript-concepts\\\/#primaryimage\",\"url\":\"https:\\\/\\\/buhave.com\\\/courses\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/Advanced-JavaScript-Concepts.webp\",\"contentUrl\":\"https:\\\/\\\/buhave.com\\\/courses\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/Advanced-JavaScript-Concepts.webp\",\"width\":1200,\"height\":628,\"caption\":\"Advanced JavaScript Concepts\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/advanced-javascript-concepts\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Courses\",\"item\":\"https:\\\/\\\/buhave.com\\\/courses\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Script Course\",\"item\":\"https:\\\/\\\/buhave.com\\\/courses\\\/learn\\\/java-script\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Advanced JavaScript Concepts\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#website\",\"url\":\"https:\\\/\\\/buhave.com\\\/courses\\\/\",\"name\":\"BUHAVE\",\"description\":\"Courses - Learn Online for Free\",\"publisher\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/buhave.com\\\/courses\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#organization\",\"name\":\"BUHAVE\",\"url\":\"https:\\\/\\\/buhave.com\\\/courses\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/buhave.com\\\/courses\\\/wp-content\\\/uploads\\\/2025\\\/03\\\/buhave-course.webp\",\"contentUrl\":\"https:\\\/\\\/buhave.com\\\/courses\\\/wp-content\\\/uploads\\\/2025\\\/03\\\/buhave-course.webp\",\"width\":375,\"height\":75,\"caption\":\"BUHAVE\"},\"image\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/BeYouHave\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/buhave\",\"https:\\\/\\\/www.youtube.com\\\/@buhave\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#\\\/schema\\\/person\\\/04fe0254e118521c9fbb3da39de5acca\",\"name\":\"Naveed Safdar\",\"description\":\"I\u2019m Naveed Safdar - SEO Manager with over 10 years of experience in SEO and Digital Marketing. I\u2019ve had the privilege of working with leading national and international companies including Grafdom, PakWheels, Systems Limited, Confiz, Educative, and Dubizzle Labs. My expertise spans technical SEO, content strategy, organic growth, and performance analytics - helping businesses improve visibility, traffic, and ROI.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/naveedsafdar\\\/\",\"https:\\\/\\\/www.facebook.com\\\/naveedsafdarawan\\\/\",\"https:\\\/\\\/www.youtube.com\\\/@naveedsafdar\"],\"url\":\"https:\\\/\\\/buhave.com\\\/courses\\\/author\\\/naveed-safdar\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Advanced JavaScript Concepts - Java Script Course","description":"Advanced JavaScript concepts delve into closures, asynchronous programming, inheritance, and patterns for efficient, structured code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/","og_locale":"en_US","og_type":"article","og_title":"Advanced JavaScript Concepts - Java Script Course","og_description":"Advanced JavaScript concepts delve into closures, asynchronous programming, inheritance, and patterns for efficient, structured code.","og_url":"https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/","og_site_name":"BUHAVE","article_publisher":"https:\/\/www.facebook.com\/BeYouHave\/","article_author":"https:\/\/www.facebook.com\/naveedsafdarawan\/","article_published_time":"2025-05-19T10:51:12+00:00","article_modified_time":"2025-05-20T12:57:38+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/04\/Advanced-JavaScript-Concepts.webp","type":"image\/webp"}],"author":"Naveed Safdar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Naveed Safdar","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/#article","isPartOf":{"@id":"https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/"},"author":{"name":"Naveed Safdar","@id":"https:\/\/buhave.com\/courses\/#\/schema\/person\/04fe0254e118521c9fbb3da39de5acca"},"headline":"Advanced JavaScript Concepts","datePublished":"2025-05-19T10:51:12+00:00","dateModified":"2025-05-20T12:57:38+00:00","mainEntityOfPage":{"@id":"https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/"},"wordCount":1540,"commentCount":0,"publisher":{"@id":"https:\/\/buhave.com\/courses\/#organization"},"image":{"@id":"https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/#primaryimage"},"thumbnailUrl":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/04\/Advanced-JavaScript-Concepts.webp","articleSection":["Java Script Course"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/","url":"https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/","name":"Advanced JavaScript Concepts - Java Script Course","isPartOf":{"@id":"https:\/\/buhave.com\/courses\/#website"},"primaryImageOfPage":{"@id":"https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/#primaryimage"},"image":{"@id":"https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/#primaryimage"},"thumbnailUrl":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/04\/Advanced-JavaScript-Concepts.webp","datePublished":"2025-05-19T10:51:12+00:00","dateModified":"2025-05-20T12:57:38+00:00","description":"Advanced JavaScript concepts delve into closures, asynchronous programming, inheritance, and patterns for efficient, structured code.","breadcrumb":{"@id":"https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/#primaryimage","url":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/04\/Advanced-JavaScript-Concepts.webp","contentUrl":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/04\/Advanced-JavaScript-Concepts.webp","width":1200,"height":628,"caption":"Advanced JavaScript Concepts"},{"@type":"BreadcrumbList","@id":"https:\/\/buhave.com\/courses\/java-script\/advanced-javascript-concepts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Courses","item":"https:\/\/buhave.com\/courses\/"},{"@type":"ListItem","position":2,"name":"Java Script Course","item":"https:\/\/buhave.com\/courses\/learn\/java-script\/"},{"@type":"ListItem","position":3,"name":"Advanced JavaScript Concepts"}]},{"@type":"WebSite","@id":"https:\/\/buhave.com\/courses\/#website","url":"https:\/\/buhave.com\/courses\/","name":"BUHAVE","description":"Courses - Learn Online for Free","publisher":{"@id":"https:\/\/buhave.com\/courses\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/buhave.com\/courses\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/buhave.com\/courses\/#organization","name":"BUHAVE","url":"https:\/\/buhave.com\/courses\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/buhave.com\/courses\/#\/schema\/logo\/image\/","url":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/03\/buhave-course.webp","contentUrl":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/03\/buhave-course.webp","width":375,"height":75,"caption":"BUHAVE"},"image":{"@id":"https:\/\/buhave.com\/courses\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/BeYouHave\/","https:\/\/www.linkedin.com\/company\/buhave","https:\/\/www.youtube.com\/@buhave"]},{"@type":"Person","@id":"https:\/\/buhave.com\/courses\/#\/schema\/person\/04fe0254e118521c9fbb3da39de5acca","name":"Naveed Safdar","description":"I\u2019m Naveed Safdar - SEO Manager with over 10 years of experience in SEO and Digital Marketing. I\u2019ve had the privilege of working with leading national and international companies including Grafdom, PakWheels, Systems Limited, Confiz, Educative, and Dubizzle Labs. My expertise spans technical SEO, content strategy, organic growth, and performance analytics - helping businesses improve visibility, traffic, and ROI.","sameAs":["https:\/\/www.linkedin.com\/in\/naveedsafdar\/","https:\/\/www.facebook.com\/naveedsafdarawan\/","https:\/\/www.youtube.com\/@naveedsafdar"],"url":"https:\/\/buhave.com\/courses\/author\/naveed-safdar\/"}]}},"_links":{"self":[{"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/posts\/564","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/comments?post=564"}],"version-history":[{"count":1,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/posts\/564\/revisions"}],"predecessor-version":[{"id":566,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/posts\/564\/revisions\/566"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/media\/565"}],"wp:attachment":[{"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/media?parent=564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/categories?post=564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/tags?post=564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}