{"id":539,"date":"2025-05-19T11:04:44","date_gmt":"2025-05-19T11:04:44","guid":{"rendered":"https:\/\/buhave.com\/courses\/?p=539"},"modified":"2025-05-20T12:57:18","modified_gmt":"2025-05-20T12:57:18","slug":"introduction-to-javascript","status":"publish","type":"post","link":"https:\/\/buhave.com\/courses\/java-script\/introduction-to-javascript\/","title":{"rendered":"Introduction to JavaScript"},"content":{"rendered":"<h2>What is JavaScript?<\/h2>\n<p>JavaScript is a powerful, high-level programming language that is primarily used to make web pages interactive and dynamic. It is one of the core technologies of the web, alongside HTML and CSS.<\/p>\n<p><strong>Definition:<\/strong><\/p>\n<p>JavaScript (often abbreviated as JS) is a scripting language that runs in the browser and allows you to create:<\/p>\n<ul>\n<li>Interactive websites (forms, buttons, sliders)<\/li>\n<li>Dynamic content updates (without refreshing the page)<\/li>\n<li>Games, animations, and real-time features (like chat)<\/li>\n<li>Backend applications (via Node.js)<\/li>\n<\/ul>\n<h3>Key Features of JavaScript<\/h3>\n<ul>\n<li>Client-side scripting: Runs directly in the user\u2019s browser.<\/li>\n<li>Dynamically typed: You don\u2019t need to specify variable types.<\/li>\n<li>Event-driven: Executes code in response to user actions.<\/li>\n<li>Interpreted language: No compilation required.<\/li>\n<li>Object-oriented and functional: Supports both paradigms.<\/li>\n<li>Cross-platform: Works in all modern browsers and many environments (like Node.js).<\/li>\n<\/ul>\n<p><strong>Quick History:<\/strong><\/p>\n<ul>\n<li>Created in 1995 by Brendan Eich at Netscape in just 10 days.<\/li>\n<li>Originally called Mocha, then LiveScript, and finally JavaScript.<\/li>\n<li>Despite the name, JavaScript is not related to Java.<\/li>\n<li>Has evolved significantly\u2014modern JavaScript (ES6+) supports classes, modules, async\/await, and more.<\/li>\n<\/ul>\n<p><strong>Why is JavaScript Important?<\/strong><\/p>\n<ul>\n<li>Enables interactivity: Forms, games, modals, tabs, etc.<\/li>\n<li>Drives modern front-end frameworks like React, Vue, Angular.<\/li>\n<li>Used in full-stack development (Node.js on the server).<\/li>\n<li>Largest developer community and an ever-growing ecosystem.<\/li>\n<li>Powers popular tools, sites, and apps (e.g., Gmail, Facebook, Netflix).<\/li>\n<\/ul>\n<p><strong>What Can JavaScript Do?<\/strong><\/p>\n<ul>\n<li>Validate user input before form submission<\/li>\n<li>Load new data using AJAX or Fetch API<\/li>\n<li>Create mobile apps using React Native or Ionic<\/li>\n<li>Control the browser (window, history, alerts)<\/li>\n<li>Animate elements and manipulate the DOM<\/li>\n<\/ul>\n<p><strong>JavaScript vs. HTML\/CSS<\/strong><\/p>\n<table>\n<thead>\n<tr>\n<th>Feature<\/th>\n<th>HTML<\/th>\n<th>CSS<\/th>\n<th>JavaScript<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Structure<\/td>\n<td>YES<\/td>\n<td>NO<\/td>\n<td>NO<\/td>\n<\/tr>\n<tr>\n<td>Styling<\/td>\n<td>NO<\/td>\n<td>YES<\/td>\n<td>NO<\/td>\n<\/tr>\n<tr>\n<td>Interactivity<\/td>\n<td>NO<\/td>\n<td>NO<\/td>\n<td>YES<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Summary:<\/strong><\/p>\n<p>JavaScript is the engine behind interactivity on the web. From simple alerts to full-fledged applications, it&#8217;s an essential tool for web developers. If HTML is the structure and CSS is the style, JavaScript is the brain of the webpage.<\/p>\n<h2>History and Role of Java Script in web development<\/h2>\n<h3>History of Java Script<\/h3>\n<p>Here is the history of Java Script (JS) since 1995 to present day.<\/p>\n<p><strong>1995 \u2013 Birth of JavaScript<\/strong><\/p>\n<p>Brendan Eich created JavaScript in just 10 days at Netscape. It was originally named Mocha, then LiveScript, and finally JavaScript (to ride on Java\u2019s popularity, although the two are unrelated).<\/p>\n<p><strong>Late 1990s \u2013 Early Use and Standardization<\/strong><\/p>\n<p>Microsoft introduced its own version, JScript, for Internet Explorer. To unify browser behavior, JavaScript was standardized as ECMAScript (ECMA-262) by ECMA International in 1997.<\/p>\n<p><strong>2000s \u2013 DOM Manipulation Era<\/strong><\/p>\n<p>JavaScript began being used more heavily to interact with HTML documents via the Document Object Model (DOM), enabling dynamic effects and simple form validation.<\/p>\n<p><strong>2005 \u2013 AJAX Revolution<\/strong><\/p>\n<p>The rise of AJAX (Asynchronous JavaScript and XML) transformed web applications by enabling dynamic, real-time data loading without page refresh. This led to web apps like Gmail, Google Maps, and Facebook.<\/p>\n<p><strong>2009 \u2013 Node.js Launch<\/strong><\/p>\n<p>JavaScript left the browser with the release of Node.js, allowing JS to run on servers and making it a full-stack language.<\/p>\n<p><strong>2015 \u2013 Modern JavaScript (ES6\/ES2015)<\/strong><\/p>\n<p>ES6 introduced significant updates like let, const, arrow functions, classes, modules, template literals, and promises\u2014bringing JS up to speed with other modern languages.<\/p>\n<p><strong>Present Day<\/strong><\/p>\n<p>JavaScript is everywhere\u2014from front-end to back-end, mobile to desktop apps, IoT devices, and even machine learning.<\/p>\n<h3>JavaScript&#8217;s Role in Web Development<\/h3>\n<p>JavaScript is a core component of web development, working alongside HTML and CSS to build modern, responsive, and interactive web applications.<\/p>\n<ul>\n<li>HTML \u2013 Provides the structure<\/li>\n<li>CSS \u2013 Provides the styling<\/li>\n<li>JavaScript \u2013 Brings interactivity and logic<\/li>\n<\/ul>\n<p><strong>JavaScript in Action:<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<th>Area<\/th>\n<th>Role of JavaScript<\/th>\n<\/tr>\n<tr>\n<td>User Interaction<\/td>\n<td>Click events, modals, dropdowns, validation<\/td>\n<\/tr>\n<tr>\n<td>Dynamic Content<\/td>\n<td>Real-time updates, AJAX calls, content generation<\/td>\n<\/tr>\n<tr>\n<td>Animation &amp; UX<\/td>\n<td>Smooth transitions, canvas drawing, sliders<\/td>\n<\/tr>\n<tr>\n<td>APIs &amp; Backends<\/td>\n<td>REST API consumption, data processing with Node.js<\/td>\n<\/tr>\n<tr>\n<td>Frameworks\/Tools<\/td>\n<td>React, Angular, Vue, Svelte, Express, Next.js, etc.<\/td>\n<\/tr>\n<tr>\n<td>Mobile\/Desktop<\/td>\n<td>Cross-platform apps using React Native, Electron<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Why JavaScript Remains Crucial<\/strong><\/p>\n<ul>\n<li>Runs in every browser<\/li>\n<li>Huge ecosystem and community<\/li>\n<li>Enables full-stack development<\/li>\n<li>Highly demanded by employers<\/li>\n<li>Continuously evolving<\/li>\n<\/ul>\n<p><strong>Summary:<\/strong><\/p>\n<p>JavaScript has evolved from a simple scripting language to a cornerstone of modern web development, powering nearly every interactive element on the internet today. Its history reflects the web\u2019s growth\u2014from static pages to rich, dynamic applications.<\/p>\n<h2>How browsers execute JavaScript<\/h2>\n<p>When a browser loads a webpage, it follows a specific process to parse and execute JavaScript, enabling dynamic behavior and interactivity on the page. Here&#8217;s how it works step-by-step:<\/p>\n<h3>Browser execute JavaScript types.<\/h3>\n<p><strong>1. HTML Parsing Begins<\/strong><\/p>\n<ul>\n<li>The browser starts reading the HTML document from top to bottom.<\/li>\n<li>It builds a DOM (Document Object Model) to represent the structure of the page.<\/li>\n<li>When it encounters a &lt;script&gt; tag (either inline or linked), it pauses HTML parsing.<\/li>\n<\/ul>\n<p><strong>2. JavaScript Engine Takes Control<\/strong><\/p>\n<ul>\n<li>The browser passes the script to its JavaScript engine:<\/li>\n<li>Chrome \u2192 V8<\/li>\n<li>Firefox \u2192 SpiderMonkey<\/li>\n<li>Safari \u2192 JavaScriptCore<\/li>\n<\/ul>\n<p>The engine parses the code into an Abstract Syntax Tree (AST), compiles it into bytecode or machine code (via JIT), and then executes it.<\/p>\n<p><strong>3. Execution Context &amp; Call Stack<\/strong><\/p>\n<ul>\n<li>The engine creates a Global Execution Context and adds it to the Call Stack.<\/li>\n<li>Each function call creates a new context and gets stacked.<\/li>\n<li>Once the function finishes, it&#8217;s popped off the stack.<\/li>\n<li>This is how JavaScript runs synchronously, one task at a time.<\/li>\n<\/ul>\n<p><strong>4. Handling Async with Event Loop<\/strong><\/p>\n<ul>\n<li>When async tasks like setTimeout(), fetch(), or event listeners occur:<\/li>\n<li>They go to Web APIs (provided by the browser).<\/li>\n<li>After completion, the callback is queued in the Callback Queue.<\/li>\n<li>The Event Loop checks the Call Stack, and if it&#8217;s empty, pushes callbacks from the queue into the stack for execution.<\/li>\n<li>This allows JavaScript to handle asynchronous tasks without blocking.<\/li>\n<\/ul>\n<p><strong>5. DOM Manipulation &amp; Re-rendering<\/strong><\/p>\n<ul>\n<li>JavaScript can update HTML elements via the DOM (document.getElementById(), etc.).<\/li>\n<li>When changes happen, the browser re-renders the affected parts of the page.<\/li>\n<\/ul>\n<p><strong>In Summary:<\/strong><\/p>\n<p>The browser parses HTML, delegates JavaScript to its engine for parsing and execution, uses the call stack and event loop to manage sync and async operations, and updates the DOM to reflect any changes.<\/p>\n<h2>Writing and running JS in browser (Console &amp; &lt;script&gt;)<\/h2>\n<h3>1. Using the Browser Console<\/h3>\n<p>This is great for quick testing, debugging, or learning JavaScript interactively.<\/p>\n<p><strong>How to Open the Console<\/strong><\/p>\n<ul>\n<li>Chrome: Right-click &gt; Inspect &gt; go to the Console tab.<\/li>\n<li>Firefox: Ctrl + Shift + K or Cmd + Option + K<\/li>\n<li>Edge: F12 or Ctrl + Shift + I &gt; Console<\/li>\n<li>Safari: Enable &#8220;Show Develop Menu&#8221; in preferences, then Cmd + Option + C<\/li>\n<\/ul>\n<p><strong>Writing JavaScript in the Console<\/strong><\/p>\n<p style=\"text-align: center\"><em>Just type code and press Enter. Multiline code can be written using Shift + Enter.<\/em><\/p>\n<p style=\"text-align: center\"><em>\/\/ Simple log<\/em><br \/>\n<em>console.log(&#8220;Hello from console!&#8221;);<\/em><\/p>\n<p style=\"text-align: center\"><em>\/\/ Variables and functions<\/em><br \/>\n<em>let name = &#8220;Alice&#8221;;<\/em><br \/>\n<em>function greet(user) {<\/em><br \/>\n<em>return `Hello, ${user}`;<\/em><br \/>\n<em>}<\/em><br \/>\n<em>console.log(greet(name));<\/em><\/p>\n<p style=\"text-align: center\"><em>\/\/ DOM manipulation<\/em><br \/>\n<em>document.body.style.backgroundColor = &#8220;lightblue&#8221;;<\/em><\/p>\n<p><strong>Tips for the Console<\/strong><\/p>\n<ul>\n<li>Use $_ to access the last result.<\/li>\n<li>Arrow keys to scroll through history.<\/li>\n<li>console.dir(obj) to explore object properties.<\/li>\n<\/ul>\n<h3>2. Using &lt;script&gt; in HTML<\/h3>\n<p>This is used for actual projects or static HTML + JS pages.<\/p>\n<p><strong>Inline JavaScript<\/strong><\/p>\n<p>Embed JavaScript directly inside your HTML file using a &lt;script&gt; tag.<\/p>\n<p style=\"text-align: center\"><em>&lt;!DOCTYPE html&gt;<\/em><br \/>\n<em>&lt;html&gt;<\/em><br \/>\n<em>&lt;head&gt;<\/em><br \/>\n<em>&lt;title&gt;Inline JS&lt;\/title&gt;<\/em><br \/>\n<em>&lt;\/head&gt;<\/em><br \/>\n<em>&lt;body&gt;<\/em><br \/>\n<em>&lt;h1&gt;Hello World&lt;\/h1&gt;<\/em><\/p>\n<p style=\"text-align: center\"><em>&lt;script&gt;<\/em><br \/>\n<em>document.querySelector(&#8216;h1&#8217;).style.color = &#8220;green&#8221;;<\/em><br \/>\n<em>console.log(&#8220;Page loaded!&#8221;);<\/em><br \/>\n<em>&lt;\/script&gt;<\/em><br \/>\n<em>&lt;\/body&gt;<\/em><br \/>\n<em>&lt;\/html&gt;<\/em><\/p>\n<ul>\n<li>This code runs as soon as the browser reaches the script tag.<\/li>\n<\/ul>\n<p><strong>External JavaScript File<\/strong><\/p>\n<p>You can also link a .js file with the src attribute.<\/p>\n<p style=\"text-align: center\"><em>&lt;!DOCTYPE html&gt;<\/em><br \/>\n<em>&lt;html&gt;<\/em><br \/>\n<em>&lt;head&gt;<\/em><br \/>\n<em>&lt;title&gt;External JS&lt;\/title&gt;<\/em><br \/>\n<em>&lt;script src=&#8221;script.js&#8221; defer&gt;&lt;\/script&gt;<\/em><br \/>\n<em>&lt;\/head&gt;<\/em><br \/>\n<em>&lt;body&gt;<\/em><br \/>\n<em>&lt;h1&gt;Hello External Script&lt;\/h1&gt;<\/em><br \/>\n<em>&lt;\/body&gt;<\/em><br \/>\n<em>&lt;\/html&gt;<\/em><\/p>\n<p style=\"text-align: center\"><em>\/\/ script.js<\/em><br \/>\n<em>document.querySelector(&#8216;h1&#8217;).style.color = &#8220;blue&#8221;;<\/em><br \/>\n<em>console.log(&#8220;External script running!&#8221;);<\/em><\/p>\n<p><strong>Why Use defer?<\/strong><\/p>\n<ul>\n<li>It waits for HTML to load before running JS.<\/li>\n<li>Keeps the DOM accessible when the script runs.<\/li>\n<\/ul>\n<p><strong>Common Pitfalls:<\/strong><\/p>\n<table>\n<thead>\n<tr>\n<th>Problem<\/th>\n<th>Why It Happens<\/th>\n<th>Fix<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>null on document.querySelector<\/td>\n<td>Script runs before DOM loads<\/td>\n<td>Use defer or DOMContentLoaded<\/td>\n<\/tr>\n<tr>\n<td>Uncaught ReferenceError<\/td>\n<td>Variable or function not defined<\/td>\n<td>Check order of script tags<\/td>\n<\/tr>\n<tr>\n<td>JS not working<\/td>\n<td>Wrong file path or MIME type<\/td>\n<td>Ensure script path is correct &amp; served properly<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Bonus:<\/strong> Using<\/p>\n<p>To ensure your script runs only after HTML is loaded:<\/p>\n<p style=\"text-align: center\"><em>document.addEventListener(&#8220;DOMContentLoaded&#8221;, function () {<\/em><br \/>\n<em>document.body.style.background = &#8220;beige&#8221;;<\/em><br \/>\n<em>});<\/em><\/p>\n<p>&nbsp;<\/p>\n<h2>Linking external JS files<\/h2>\n<h3>1. Basic Syntax for Linking JS<\/h3>\n<p><strong>Use the &lt;script&gt; tag with the src attribute inside your HTML file:<\/strong><\/p>\n<p style=\"text-align: center\"><em>&lt;script src=&#8221;path\/to\/your-script.js&#8221;&gt;&lt;\/script&gt;<\/em><\/p>\n<p>This tells the browser to fetch and run the code inside the external JS file.<\/p>\n<h3>2. File Structure Example<\/h3>\n<p><strong>Let&#8217;s say your project is structured like this:<\/strong><\/p>\n<p style=\"text-align: center\"><em>project-folder\/<\/em><br \/>\n<em>\u2502<\/em><br \/>\n<em>\u251c\u2500\u2500 index.html<\/em><br \/>\n<em>\u2514\u2500\u2500 js\/<\/em><br \/>\n<em>\u2514\u2500\u2500 app.js<\/em><\/p>\n<p><strong>To link app.js in index.html:<\/strong><\/p>\n<p style=\"text-align: center\"><em>&lt;script src=&#8221;js\/app.js&#8221;&gt;&lt;\/script&gt;<\/em><\/p>\n<p>This path is relative to the location of the HTML file.<\/p>\n<h3>3. Where to Place the &lt;script&gt; Tag<\/h3>\n<p><strong>Option 1: At the End of &lt;body&gt;<\/strong><\/p>\n<p>This is the classic and safe approach.<\/p>\n<p style=\"text-align: center\"><em>&lt;body&gt;<\/em><br \/>\n<em>&lt;!&#8211; page content &#8211;&gt;<\/em><br \/>\n<em>&lt;script src=&#8221;js\/app.js&#8221;&gt;&lt;\/script&gt;<\/em><br \/>\n<em>&lt;\/body&gt;<\/em><\/p>\n<ul>\n<li>Ensures the HTML is fully loaded before JS runs.<\/li>\n<li>No need to wait or wrap your code in DOMContentLoaded.<\/li>\n<\/ul>\n<p><strong>Option 2: In the &lt;head&gt; with defer<\/strong><\/p>\n<p style=\"text-align: center\"><em>&lt;head&gt;<\/em><br \/>\n<em>&lt;script src=&#8221;js\/app.js&#8221; defer&gt;&lt;\/script&gt;<\/em><br \/>\n<em>&lt;\/head&gt;<\/em><\/p>\n<p><strong>defer tells the browser:<\/strong><\/p>\n<ul>\n<li>Download immediately (non-blocking),<\/li>\n<li>but run after HTML is parsed.<\/li>\n<li>Keeps scripts and markup cleanly separated.<\/li>\n<\/ul>\n<p>Avoid async for scripts that interact with the DOM \u2014 it can run before the DOM is ready.<\/p>\n<h3>4. Common Issues<\/h3>\n<table>\n<thead>\n<tr>\n<th>Issue<\/th>\n<th>Cause<\/th>\n<th>Fix<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Uncaught ReferenceError<\/td>\n<td>Script ran before the HTML loaded<\/td>\n<td>Move script to end of body or add defer<\/td>\n<\/tr>\n<tr>\n<td>Script doesn&#8217;t load<\/td>\n<td>Wrong path<\/td>\n<td>Double-check file structure and file names<\/td>\n<\/tr>\n<tr>\n<td>JS file not found (404)<\/td>\n<td>Mistyped path<\/td>\n<td>Use browser dev tools (Network tab) to debug<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>5. External JS Example<\/h3>\n<p><strong>HTML (index.html):<\/strong><\/p>\n<p style=\"text-align: center\"><em>&lt;!DOCTYPE html&gt;<\/em><br \/>\n<em>&lt;html&gt;<\/em><br \/>\n<em>&lt;head&gt;<\/em><br \/>\n<em>&lt;title&gt;My Page&lt;\/title&gt;<\/em><br \/>\n<em>&lt;script src=&#8221;app.js&#8221; defer&gt;&lt;\/script&gt;<\/em><br \/>\n<em>&lt;\/head&gt;<\/em><br \/>\n<em>&lt;body&gt;<\/em><br \/>\n<em>&lt;h1&gt;Welcome&lt;\/h1&gt;<\/em><br \/>\n<em>&lt;button id=&#8221;btn&#8221;&gt;Click Me&lt;\/button&gt;<\/em><br \/>\n<em>&lt;\/body&gt;<\/em><br \/>\n<em>&lt;\/html&gt;<\/em><\/p>\n<p><strong>JavaScript (app.js):<\/strong><\/p>\n<p style=\"text-align: center\"><em>document.getElementById(&#8220;btn&#8221;).addEventListener(&#8220;click&#8221;, function () {<\/em><br \/>\n<em>alert(&#8220;Button clicked!&#8221;);<\/em><br \/>\n<em>});<\/em><\/p>\n<ul>\n<li>Clicking the button will trigger the alert.<\/li>\n<\/ul>\n<h3>6. Linking Multiple JS Files<\/h3>\n<p><strong>If you need to load several JS files:<\/strong><\/p>\n<p style=\"text-align: center\"><em>&lt;script src=&#8221;lib.js&#8221; defer&gt;&lt;\/script&gt;<\/em><br \/>\n<em>&lt;script src=&#8221;utils.js&#8221; defer&gt;&lt;\/script&gt;<\/em><br \/>\n<em>&lt;script src=&#8221;main.js&#8221; defer&gt;&lt;\/script&gt;<\/em><\/p>\n<ul>\n<li>Order matters if the scripts depend on each other.<\/li>\n<li>With defer, they execute in order.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>What is JavaScript? JavaScript is a powerful, high-level programming language that is primarily used to make web pages interactive and dynamic. It is one of the core technologies of the web, alongside HTML and CSS. Definition: JavaScript (often abbreviated as JS) is a scripting language<\/p>\n","protected":false},"author":1,"featured_media":541,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-539","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>Introduction to JavaScript -<\/title>\n<meta name=\"description\" content=\"JavaScript is a dynamic, interpreted programming language used primarily to create interactive and dynamic content on websites.\" \/>\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\/introduction-to-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Introduction to JavaScript -\" \/>\n<meta property=\"og:description\" content=\"JavaScript is a dynamic, interpreted programming language used primarily to create interactive and dynamic content on websites.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/buhave.com\/courses\/java-script\/introduction-to-javascript\/\" \/>\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-19T11:04:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-20T12:57:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/04\/Introduction-to-JavaScript.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\\\/introduction-to-javascript\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/introduction-to-javascript\\\/\"},\"author\":{\"name\":\"Naveed Safdar\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#\\\/schema\\\/person\\\/04fe0254e118521c9fbb3da39de5acca\"},\"headline\":\"Introduction to JavaScript\",\"datePublished\":\"2025-05-19T11:04:44+00:00\",\"dateModified\":\"2025-05-20T12:57:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/introduction-to-javascript\\\/\"},\"wordCount\":1817,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/introduction-to-javascript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/buhave.com\\\/courses\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/Introduction-to-JavaScript.webp\",\"articleSection\":[\"Java Script Course\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/introduction-to-javascript\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/introduction-to-javascript\\\/\",\"url\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/introduction-to-javascript\\\/\",\"name\":\"Introduction to JavaScript -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/introduction-to-javascript\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/introduction-to-javascript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/buhave.com\\\/courses\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/Introduction-to-JavaScript.webp\",\"datePublished\":\"2025-05-19T11:04:44+00:00\",\"dateModified\":\"2025-05-20T12:57:18+00:00\",\"description\":\"JavaScript is a dynamic, interpreted programming language used primarily to create interactive and dynamic content on websites.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/introduction-to-javascript\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/introduction-to-javascript\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/introduction-to-javascript\\\/#primaryimage\",\"url\":\"https:\\\/\\\/buhave.com\\\/courses\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/Introduction-to-JavaScript.webp\",\"contentUrl\":\"https:\\\/\\\/buhave.com\\\/courses\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/Introduction-to-JavaScript.webp\",\"width\":1200,\"height\":628,\"caption\":\"Introduction to JavaScript\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/buhave.com\\\/courses\\\/java-script\\\/introduction-to-javascript\\\/#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\":\"Introduction to JavaScript\"}]},{\"@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":"Introduction to JavaScript -","description":"JavaScript is a dynamic, interpreted programming language used primarily to create interactive and dynamic content on websites.","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\/introduction-to-javascript\/","og_locale":"en_US","og_type":"article","og_title":"Introduction to JavaScript -","og_description":"JavaScript is a dynamic, interpreted programming language used primarily to create interactive and dynamic content on websites.","og_url":"https:\/\/buhave.com\/courses\/java-script\/introduction-to-javascript\/","og_site_name":"BUHAVE","article_publisher":"https:\/\/www.facebook.com\/BeYouHave\/","article_author":"https:\/\/www.facebook.com\/naveedsafdarawan\/","article_published_time":"2025-05-19T11:04:44+00:00","article_modified_time":"2025-05-20T12:57:18+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/04\/Introduction-to-JavaScript.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\/introduction-to-javascript\/#article","isPartOf":{"@id":"https:\/\/buhave.com\/courses\/java-script\/introduction-to-javascript\/"},"author":{"name":"Naveed Safdar","@id":"https:\/\/buhave.com\/courses\/#\/schema\/person\/04fe0254e118521c9fbb3da39de5acca"},"headline":"Introduction to JavaScript","datePublished":"2025-05-19T11:04:44+00:00","dateModified":"2025-05-20T12:57:18+00:00","mainEntityOfPage":{"@id":"https:\/\/buhave.com\/courses\/java-script\/introduction-to-javascript\/"},"wordCount":1817,"commentCount":0,"publisher":{"@id":"https:\/\/buhave.com\/courses\/#organization"},"image":{"@id":"https:\/\/buhave.com\/courses\/java-script\/introduction-to-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/04\/Introduction-to-JavaScript.webp","articleSection":["Java Script Course"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/buhave.com\/courses\/java-script\/introduction-to-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/buhave.com\/courses\/java-script\/introduction-to-javascript\/","url":"https:\/\/buhave.com\/courses\/java-script\/introduction-to-javascript\/","name":"Introduction to JavaScript -","isPartOf":{"@id":"https:\/\/buhave.com\/courses\/#website"},"primaryImageOfPage":{"@id":"https:\/\/buhave.com\/courses\/java-script\/introduction-to-javascript\/#primaryimage"},"image":{"@id":"https:\/\/buhave.com\/courses\/java-script\/introduction-to-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/04\/Introduction-to-JavaScript.webp","datePublished":"2025-05-19T11:04:44+00:00","dateModified":"2025-05-20T12:57:18+00:00","description":"JavaScript is a dynamic, interpreted programming language used primarily to create interactive and dynamic content on websites.","breadcrumb":{"@id":"https:\/\/buhave.com\/courses\/java-script\/introduction-to-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/buhave.com\/courses\/java-script\/introduction-to-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/buhave.com\/courses\/java-script\/introduction-to-javascript\/#primaryimage","url":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/04\/Introduction-to-JavaScript.webp","contentUrl":"https:\/\/buhave.com\/courses\/wp-content\/uploads\/2025\/04\/Introduction-to-JavaScript.webp","width":1200,"height":628,"caption":"Introduction to JavaScript"},{"@type":"BreadcrumbList","@id":"https:\/\/buhave.com\/courses\/java-script\/introduction-to-javascript\/#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":"Introduction to JavaScript"}]},{"@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\/539","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=539"}],"version-history":[{"count":2,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/posts\/539\/revisions"}],"predecessor-version":[{"id":542,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/posts\/539\/revisions\/542"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/media\/541"}],"wp:attachment":[{"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/media?parent=539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/categories?post=539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buhave.com\/courses\/wp-json\/wp\/v2\/tags?post=539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}