74
74 points

A set of rules that define well-written JavaScript programs call the syntax of JavaScript.

Content

  • The constants in JavaScript
    • numerical constants
    • text constants
  • Variables in JavaScrip
  • Operators
  • JavaScript expressions
  • Comments in JavaScript
plus500

The constants in JavaScript

numerical constants

Numerical constants may be written with or without decimals or exponents, for example:

  • 101
  • 1.25
  • 12000e10

 text constants

Text constants are written with quotation marks or apostrophes within:

  • “Name surname”
  • ‘Name surname’

Variables in JavaScript

Variables are used to store values. Defining a variable in JavaScript is done using the keyword “var”, for example: In the first place this code we have the keyword “var” created variable “size”, and the second line we add this variable value “123”. This code we can write this:

var size;
size = 125;


var size = 125:

Operators in JavaScript

JavaScript arithmetic operators are used to calculate the value. For example in JavaScript is possible for something like: ((2 * 5) + 10) / second
Assignment operator assigns values to variables, for example: a = 10 ;.

 JavaScript Expressions

In programming terms are whole or programming instructions. These units are in JavaScript separated by a semicolon “;”.

For example, this can be written and thus, in a single line:

a = 1+2;
b = a + 3;


a = 1+2; b = a + 3;

Comments in JavaScript

Rows with comments in JavaScript code, starting with two slashes “//”. Thus, for example row:

// Ovo je komentar

be ignored during execution of JavaScript code and we will help in understanding the code.


Like it? Share with your friends!

74
74 points
Admin

0 Comments

Choose A Format
Personality quiz
Series of questions that intends to reveal something about the personality
Trivia quiz
Series of questions with right and wrong answers that intends to check knowledge
Poll
Voting to make decisions or determine opinions
Story
Formatted Text with Embeds and Visuals
List
The Classic Internet Listicles
Countdown
The Classic Internet Countdowns
Open List
Submit your own item and vote up for the best submission
Ranked List
Upvote or downvote to decide the best list item
Meme
Upload your own images to make custom memes
Video
Youtube, Vimeo or Vine Embeds
Audio
Soundcloud or Mixcloud Embeds
Image
Photo or GIF
Gif
GIF format