# ECMAScript
TIP
ECMAScript (ES) is a scripting language specification standardized by ECMAScript International
# Support
# The Basic
- Dynamic Typing
- JavaScript is an
un-typed
language - a JavaScript variable can hold a value of
any
data type - The value type of a variable can
change
during the execution of a program and JavaScript takes care of itautomatically
- Strong constrain type, view TypeScirpt
- JavaScript is an
- Variable Scope
Global Scope
: can be accessed from withinany
part of the JavaScript codeLocal Scope
: can be accessed from within afunction
where it is declared
- Variable hoisting
- variables will be
initialized
to undefined by default - JavaScript runtime will scan for variable declarations and
put
them to thetop
of thefunction
orscript
- variables will be
# Basic Operators
2 + 3
Here in theexpression
,2
and3
areoperands
and the symbol+
(plus) is theoperator
- Arithmetic
+
++
-
--
*
%
/
- Relational
>
<
==
>=
<=
!=
- Logical
&&
||
!
- Bitwise
&
|
^
~
<<
>>
>>>
- Assignment
=
+=
-=
*=
/=
typeof
- Spread
...
converts an array into individual array elements
# about loop
for...in
loop through anobject
'sproperties
var obj = {a:1, b:2, c:3};
for (var prop in obj) {
console.log(obj[prop]); // 1 2 3
}
for…of
iterateiterables
instead of object literals
for (let val of[12 , 13 , 123]){
console.log(val) // 12 13 123
}