JavaScript Syntax- Tutorialpath

JavaScript Comments
JavaScript Comments

JavaScript Syntax

The <script> tag is used to define a client-side script (JavaScript).

The <script> element either contains scripting statements, or it points to an external script file through the src attribute.

Basic Syntax of JavaScript
Basic Syntax of JavaScript

The script tags are two important attributes −

  • Type − This attribute is what is now recommended to indicate the scripting language in use and its value should be set to “text/javascript”.
  • Language − The basic form of the language attribute is very easy to implement. Simply shove in the keyword “language=”, followed by “JavaScript“, into your <script> tag.

 

script tags attribute
script tags attribute

JavaScript Comments

The purpose of a comment is to describe or explain the program:-

JavaScript uses C style  and C++ style comments for both single-line and block comments.

A single comment starts with two forward slashes. (//).

A block comment starts with a forward slash and asterisk (*/) and closing tag (/*).

JavaScript - Comment
JavaScript – Comment

 

Leave a Reply

Your email address will not be published. Required fields are marked *