

{"id":50534,"date":"2019-02-23T11:30:09","date_gmt":"2019-02-23T06:00:09","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=50534"},"modified":"2019-08-03T11:55:18","modified_gmt":"2019-08-03T06:25:18","slug":"javascript-syntax","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/javascript-syntax\/","title":{"rendered":"JavaScript Syntax &#8211; Where JavaScript Code takes Birth!"},"content":{"rendered":"<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:1458,&quot;href&quot;:&quot;https:\\\/\\\/en.wikipedia.org\\\/wiki\\\/HTML&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20251203082718\\\/https:\\\/\\\/en.wikipedia.org\\\/wiki\\\/HTML&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-09 07:35:14&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-12 10:17:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-15 14:18:41&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-19 11:46:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-22 17:27:55&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-26 04:39:37&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-29 06:13:40&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-01 12:33:21&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-04 14:41:14&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-07 14:50:26&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-12 03:49:12&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-15 06:39:11&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-18 15:51:01&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-22 09:06:31&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-25 11:36:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-28 12:18:23&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-01 11:00:41&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-04 11:52:09&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-07 19:34:48&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-11 08:06:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-14 11:08:12&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-17 13:16:01&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-21 16:30:16&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-24 21:04:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-28 07:34:18&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-03 16:14:19&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-06 23:42:31&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-10 08:10:12&quot;,&quot;http_code&quot;:429},{&quot;date&quot;:&quot;2026-03-14 17:30:14&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-18 05:20:31&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-21 19:42:45&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-25 09:27:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-29 22:18:37&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-03 07:41:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-07 06:52:04&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-12 02:53:22&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-15 05:14:32&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-18 17:56:48&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-22 12:28:24&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-25 20:51:41&quot;,&quot;http_code&quot;:429},{&quot;date&quot;:&quot;2026-04-29 09:43:32&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-02 16:58:16&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-06 11:49:55&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-09 16:40:31&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-16 02:36:06&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-19 10:01:10&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-22 11:06:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-25 15:17:36&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-28 18:29:32&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-01 18:07:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-04 21:02:14&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-08 08:56:21&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-06-12 12:03:08&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-12 12:03:08&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]'><\/div>\n<p>Previously, we learned about all the core aspects of JavaScript in <em><strong><a href=\"https:\/\/data-flair.training\/blogs\/javascript-tutorial\/\">JavaScript tutorial<\/a><\/strong><\/em>, now, moving ahead in the DataFlair&#8217;s JavaScript Tutorial Series, we will understand the JavaScript Syntax.<\/p>\n<p>This tutorial will help you to write your first JavaScript code. From here on, you will start implementing JavaScript as you learn. But first, you need to understand the syntax of JavaScript and how it works. It&#8217;s the time to dive into the concept.<\/p>\n<h2>What is JavaScript Syntax?<\/h2>\n<p><em>JavaScript syntax refers to the set of rules that determine how the programmer constructs and the browser interprets JavaScript programs.<\/em><\/p>\n<p>Before starting with JavaScript, let us first understand how to add JavaScript to an HTML file:<\/p>\n<h3>The HTML &lt;script&gt; Tag<\/h3>\n<p>The<strong> &lt;script&gt;<\/strong> tag in HTML defines a client-side script like JavaScript. We can add the tags in any of the following locations:<\/p>\n<ul>\n<li>Inside the &lt;head&gt; tag<\/li>\n<li>Inside the &lt;body&gt; tag<\/li>\n<li>In an external file<\/li>\n<\/ul>\n<p>If embedded in the HTML file, we must write JavaScript code like this:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;script&gt;\r\nJavaScript code\r\n&lt;\/script&gt;<\/pre>\n<p>The alternative is to add an external JavaScript file in our HTML document. This separates the HTML code from the JavaScript code, making it a lot easier for the programmer to edit the code.<\/p>\n<p>The most common attributes of <strong>&lt;script&gt;<\/strong> tag are src and type.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;script src= \u2018my_js_file.js\u2019 type= 'text\/javascript'&gt;&lt;\/script&gt;<\/pre>\n<p>The src attribute specifies the URI of an external script. A URI or Uniform Resource Identifier is a sequence of characters that identifies a logical or physical resource.<\/p>\n<p>The type attribute defines the type of file represented.<\/p>\n<p>In case we want to provide content for those users who have disabled JavaScript, we use the <strong>&lt;noscript&gt;<\/strong> tag.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;html&gt;\r\n&lt;body&gt;\r\n     &lt;p id=\"test\"&gt;Hello DataFlair!&lt;\/p&gt;\r\n     &lt;script&gt;\r\n     document.getElementById('test').innerHTML = \"My first JavaScript code!\"\r\n     &lt;\/script&gt;\r\n\r\n     &lt;noscript&gt;\r\n     Sorry, JavaScript not supported :(\r\n     &lt;\/noscript&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p><strong>Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-screenshot.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-66583 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-screenshot.jpg\" alt=\"HTML script tag screenshot - JavaScript Syntax\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-screenshot.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-screenshot-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-screenshot-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-screenshot-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-screenshot-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-screenshot-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<p>If JavaScript is <strong>enabled<\/strong> in your browser, the result will be:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-output.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"img-gray-border aligncenter wp-image-66584 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-output.jpg\" alt=\"HTML script tag output - JavaScript Syntax\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-output.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-output-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-output-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-output-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-output-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-output-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<p>If not, the <strong>output<\/strong> in your browser will be:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-output-2-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"img-gray-border alignleft wp-image-66586 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-output-2-1.jpg\" alt=\"HTML script tag output 2 - JavaScript Syntax\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-output-2-1.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-output-2-1-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-output-2-1-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-output-2-1-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-output-2-1-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-output-2-1-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<p>JavaScript syntax includes various components that we will explore in this tutorial. We will discuss all of them in detail later on in our tutorial. For now, we will try to grasp the basic idea of the syntax with the help of a code.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;html&gt;\r\n&lt;body&gt;\r\n\r\n      &lt;script&gt;\r\n      var operand1, operand2, sum; \/\/declaring variables\r\n      operand1 = 10;\r\n      operand2 = 20; \/\/assigning values to the variables operand1 &amp; operand2\r\n                  \/* A JavaScript Expression *\/\r\n      sum = operand1 + operand2; \/\/using arithmetic and assignment operators\r\n      document.write(\"Sum of \" + operand1 + \" and \" + operand2 + \" is \" + sum);\r\n      &lt;\/script&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p><strong>Screenshot:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-var-operand-screenshot.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-66587 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-var-operand-screenshot.jpg\" alt=\"HTML script tag var operand screenshot - JavaScript Syntax\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-var-operand-screenshot.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-var-operand-screenshot-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-var-operand-screenshot-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-var-operand-screenshot-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-var-operand-screenshot-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-var-operand-screenshot-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<p>The<strong> output<\/strong> of this code in the browser would be:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-var-operand-output.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"img-gray-border aligncenter wp-image-66590 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-var-operand-output.jpg\" alt=\"HTML script tag var operand output - JavaScript Syntax\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-var-operand-output.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-var-operand-output-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-var-operand-output-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-var-operand-output-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-var-operand-output-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/08\/HTML-script-tag-var-operand-output-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<p>Note that we embedded this code in an HTML file. This is because we cannot execute a JavaScript file on the browser on its own. So we use the\u00a0<strong>&lt;script&gt;<\/strong>\u00a0tag to add JavaScript in our <a href=\"https:\/\/en.wikipedia.org\/wiki\/HTML\">HTML<\/a> code. You can also add an external JavaScript file, the output will remain the same.<\/p>\n<p><em><strong>Wait! Have you checked the <a href=\"https:\/\/data-flair.training\/blogs\/features-of-javascript\/\">Latest Features of JavaScript<\/a><\/strong><\/em><\/p>\n<h3>JavaScript Values<\/h3>\n<p>JavaScript syntax includes two types of values:<\/p>\n<ul>\n<li><strong>Fixed values\u00a0 <\/strong><\/li>\n<li><strong>Variable values<\/strong><\/li>\n<\/ul>\n<p>The fixed values are <strong>Literals<\/strong> while the variable values are <strong>Variables.<\/strong><\/p>\n<p>A literal is a way to create values in JavaScript; it takes the value you provide and creates a data value from it. In the code,<strong> 10<\/strong> and<strong> 20<\/strong> are the literals we provided and store the literal 30 after computation.<\/p>\n<p>A variable is simply the name of the storage location where we store the data and we can easily alter it. In the above code,\u00a0<strong>operand1, operand2 and sum<\/strong> are the variables that we operated on.<\/p>\n<h3>JavaScript Operators<\/h3>\n<p>The various operators in JavaScript are symbols that allow us to perform operations on operands. We use Arithmetic operators <strong>( +, -, *, \/, %)<\/strong> to calculate the value and Assignment operators <strong>( =, +=, -=, *=)<\/strong> to allocate values to the variables.<\/p>\n<p>In the above code, we used <em>assignment operator =<\/em> and <em>arithmetic operator +<\/em> for addition and concatenation (joining the strings together).<\/p>\n<p><em><strong>Grab complete knowledge with our separate article on <a href=\"https:\/\/data-flair.training\/blogs\/javascript-operator\/\">JavaScript Operators<\/a><\/strong><\/em><\/p>\n<h3>JavaScript Expressions<\/h3>\n<p>These are the combination of values, operators, and variables. They are used to compute the value.<\/p>\n<p><strong>sum = operand1 + operand2<\/strong>; is the expression used in the code.<\/p>\n<h3>JavaScript Keywords<\/h3>\n<p>These are <strong>reserved words<\/strong> in JavaScript that have some special meaning and thus cannot be used as identifiers. <strong>For example &#8211;<\/strong> JavaScript uses the<strong> var<\/strong> keyword to declare a variable.<\/p>\n<h3>JavaScript Identifiers<\/h3>\n<p>We use them to name variables in a program. They follow certain rules:<\/p>\n<ul>\n<li>Identifiers must start with a <em>letter, dollar sign ($), or underscore (_).<\/em><\/li>\n<li>Identifiers only consist of <em>letters, numbers, dollar sign ($), and underscore (_).<\/em><\/li>\n<li>An identifier cannot be a keyword.<\/li>\n<\/ul>\n<h3>JavaScript Data Types<\/h3>\n<p>JavaScript provides different data types to hold different variable values. These are mainly of two types: <em>Primitive and Non-Primitive (Reference)<\/em>.<\/p>\n<p><strong><span style=\"color: #333333\"><em>Want to learn more, right?\u00a0<\/em><em>Check our complete <a href=\"https:\/\/data-flair.training\/blogs\/javascript-data-types\/\">tutorial on JavaScript Data Types<\/a><\/em><\/span><\/strong><\/p>\n<h3>JavaScript Comments<\/h3>\n<p>This JavaScript code is not executed. These include additional notes for the programmer. JavaScript interpreter considers any code after <em>double slashes<strong> \/\/<\/strong><\/em> and between<em> <strong>\/*<\/strong><\/em> and <em><strong>*\/<\/strong> <\/em>as a comment.<\/p>\n<p>It is clear in the above example that the comments are never interpreted by the browser.<\/p>\n<h2>Summary<\/h2>\n<p>Here we come to the end of our article on JavaScript Syntax. In the following article, we discussed the basics of JavaScript syntax. Now you know what JavaScript actually is and how the browser interprets it. These are the basic blocks that define the whole structure of JavaScript. Therefore it is very important to understand them correctly to be an expert in JavaScript.<\/p>\n<p><em><strong>Time to move on to the next article &#8211; <a href=\"https:\/\/data-flair.training\/blogs\/javascript-architecture\/\">JavaScript Architecture<\/a><\/strong><\/em><\/p>\n<p>Hope the information provided was useful to you. Drop your feedback and queries below in the comment section.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Previously, we learned about all the core aspects of JavaScript in JavaScript tutorial, now, moving ahead in the DataFlair&#8217;s JavaScript Tutorial Series, we will understand the JavaScript Syntax. This tutorial will help you to&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":66623,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18979],"tags":[18983,20797,19298,19007,20514],"class_list":["post-50534","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-javascript-data-types","tag-javascript-expressions","tag-javascript-operators","tag-javascript-syntax","tag-javascript-values"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>JavaScript Syntax - Where JavaScript Code takes Birth! - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn all the essential aspects of JavaScript Syntax including HTML script tag, JavaScript values, operators, expressions, keywords, identifiers, datatypes and comments.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/javascript-syntax\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Syntax - Where JavaScript Code takes Birth! - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn all the essential aspects of JavaScript Syntax including HTML script tag, JavaScript values, operators, expressions, keywords, identifiers, datatypes and comments.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/javascript-syntax\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-02-23T06:00:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-08-03T06:25:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/02\/JavaScript-Syntax-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JavaScript Syntax - Where JavaScript Code takes Birth! - DataFlair","description":"Learn all the essential aspects of JavaScript Syntax including HTML script tag, JavaScript values, operators, expressions, keywords, identifiers, datatypes and comments.","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:\/\/data-flair.training\/blogs\/javascript-syntax\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Syntax - Where JavaScript Code takes Birth! - DataFlair","og_description":"Learn all the essential aspects of JavaScript Syntax including HTML script tag, JavaScript values, operators, expressions, keywords, identifiers, datatypes and comments.","og_url":"https:\/\/data-flair.training\/blogs\/javascript-syntax\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2019-02-23T06:00:09+00:00","article_modified_time":"2019-08-03T06:25:18+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/02\/JavaScript-Syntax-1.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/javascript-syntax\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/javascript-syntax\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"JavaScript Syntax &#8211; Where JavaScript Code takes Birth!","datePublished":"2019-02-23T06:00:09+00:00","dateModified":"2019-08-03T06:25:18+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/javascript-syntax\/"},"wordCount":865,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/javascript-syntax\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/02\/JavaScript-Syntax-1.jpg","keywords":["JavaScript Data Types","JavaScript Expressions","Javascript operators","JavaScript Syntax","JavaScript Values"],"articleSection":["JavaScript Tutorial"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/javascript-syntax\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/javascript-syntax\/","url":"https:\/\/data-flair.training\/blogs\/javascript-syntax\/","name":"JavaScript Syntax - Where JavaScript Code takes Birth! - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/javascript-syntax\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/javascript-syntax\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/02\/JavaScript-Syntax-1.jpg","datePublished":"2019-02-23T06:00:09+00:00","dateModified":"2019-08-03T06:25:18+00:00","description":"Learn all the essential aspects of JavaScript Syntax including HTML script tag, JavaScript values, operators, expressions, keywords, identifiers, datatypes and comments.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/javascript-syntax\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/javascript-syntax\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/javascript-syntax\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/02\/JavaScript-Syntax-1.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2019\/02\/JavaScript-Syntax-1.jpg","width":802,"height":420,"caption":"JavaScript Syntax"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/javascript-syntax\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"JavaScript Tutorial","item":"https:\/\/data-flair.training\/blogs\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"JavaScript Syntax &#8211; Where JavaScript Code takes Birth!"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team specializes in creating clear, actionable content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Backed by industry expertise, we make learning easy and career-oriented for beginners and pros alike.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam3\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/50534","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=50534"}],"version-history":[{"count":10,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/50534\/revisions"}],"predecessor-version":[{"id":66626,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/50534\/revisions\/66626"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/66623"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=50534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=50534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=50534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}