Getting Started

Description

Getting Started with JavaScript
Deepak Kumar
Note by Deepak Kumar, updated more than 1 year ago
Deepak Kumar
Created by Deepak Kumar about 7 years ago
10
0

Resource summary

Page 1

JavaScript is case-sensitive and uses the Unicode character set. In JavaScript, instructions are called statements and are separated by a semicolon (;). It is recommended to always add semicolons to end your statements; it will avoid side effects.Spaces, tabs and newline characters are called whitespace. The source text of JavaScript scripts gets scanned from left to right and is converted into a sequence of input elements which are tokens, control characters, line terminators, comments or whitespace.CommentsThe syntax of comments is the same as in C++ and in many other languages:// a one line comment /* this is a longer, multi-line comment */ /* You can't, however, /* nest comments */ SyntaxError */VariablesYou use variables as symbolic names for values in your application. The names of variables, called identifiers, conform to certain rules.A JavaScript identifier must start with a letter, underscore (_), or dollar sign ($); subsequent characters can also be digits (0-9). Because JavaScript is case sensitive, letters include the characters "A" through "Z" (uppercase) and the characters "a" through "z" (lowercase).There are three kinds of declarations in JavaScript: var : Declares a variable, optionally initializing it to a value. let : Declares a block scope local variable, optionally initializing it to a value. const : Declares a read-only named constant. You can declare a variable in three ways: With the keyword var. For example, var x = 42. This syntax can be used to declare both local and global variables. By simply assigning it a value. For example, x = 42. This always declares a global variable, if it is declared outside of any function. It generates a strict JavaScript warning. You shouldn't use this variant. With the keyword let. For example, let y = 13. This syntax can be used to declare a block scope local variable. See Variable scope below. Note: A variable declared using the var or let statement with no initial value specified has the value undefined. An attempt to access an undeclared variable will result in a ReferenceError exception being thrown. The undefined value behaves as false when used in a boolean context.

Show full summary Hide full summary

Similar

Getting Started in Blacksmithing
Khanh Khong
On-Boarding
sallyannmawby
Welcome to ExamTime!
Maya V.
Welcome to ExamTime!
Andrea Leyden
Welcome to ExamTime!
dirajen.pullay1
USA and Vietnam (1964-1975) - Part 1
Lewis Appleton-Jones
Of Mice and Men Plot Overview
Landon Valencia
French Revolution quiz
Sarah Egan
New GCSE history content
Sarah Egan
Basic Korean Verbs
ASHISH AWALGAONKAR
1PR101 2.test - Část 12.
Nikola Truong