عن كتاب ES6 tutorialspoint:
في هذا الكتاب كل ما تحمله javascript في الإصدار es6 من مميزات وكيفية تنصيب البيئة الخاصة بها على جهازك
ES6 tutorialspoint .
About the Tutorial
ECMAScript (ES) is a scripting language specification standardized by ECMAScript
International. It is used by applications to enable client-side scripting. Languages like
JavaScript, Jscript and ActionScript are governed by this specification.
This tutorial introduces you to ES6 implementation in JavaScript.
Audience
This tutorial has been prepared for JavaScript developers who are keen on knowing the
difference between ECMAScript 5 and ECMAScript 6. It is useful for those who want to
learn the latest developments in the language and implement the same in JavaScript.
Prerequisites
You need to have a basic understanding of JavaScript to make the most of this tutorial.
Disclaimer & Copyright
Copyright 2016 by Tutorials Point (I) Pvt. Ltd.
All the content and graphics published in this e-book are the property of Tutorials Point (I)
Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish
any contents or a part of contents of this e-book in any manner without written consent
of the publisher.
We strive to update the contents of our website and tutorials as timely and as precisely as
possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt.
Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our
website or its contents including this tutorial. If you discover any errors on our website or
in this tutorial, please notify us at contact@tutorialspoint.com.
ES6
ii
Table of Contents
About the Tutorial .................................................................................................................................... i
Audience .................................................................................................................................................. i
Prerequisites ............................................................................................................................................ i
Disclaimer & Copyright ............................................................................................................................. i
Table of Contents .................................................................................................................................... ii
1. ES6 − OVERVIEW ................................................................................................................. 1
JavaScript ................................................................................................................................................ 1
2. ES6 − ENVIRONMENT .......................................................................................................... 2
Local Environment Setup......................................................................................................................... 2
Installation on Windows ......................................................................................................................... 2
Installation on Mac OS X ......................................................................................................................... 3
Installation on Linux ................................................................................................................................ 4
Integrated Development Environment (IDE) Support .............................................................................. 4
Visual Studio Code .................................................................................................................................. 4
Brackets .................................................................................................................................................. 7
3. ES6 − SYNTAX .................................................................................................................... 10
Whitespace and Line Breaks .................................................................................................................. 11
Comments in JavaScript ........................................................................................................................ 11
Your First JavaScript Code ..................................................................................................................... 12
Executing the Code ................................................................................................................................ 12
Node.js and JS/ES6 ................................................................................................................................ 13
The Strict Mode ..................................................................................................................................... 13
ES6 and Hoisting .................................................................................................................................... 14
ES6
iii
4. ES6 − VARIABLES ............................................................................................................... 15
Type Syntax ........................................................................................................................................... 15
JavaScript and Dynamic Typing ............................................................................................................. 16
JavaScriptVariable Scope ....................................................................................................................... 16
The Let and Block Scope ........................................................................................................................ 17
The const ............................................................................................................................................... 18
ES6 and Variable Hoisting ...................................................................................................................... 18
5. ES6 − OPERATORS ............................................................................................................. 20
Arithmetic Operators ............................................................................................................................ 20
Relational Operators ............................................................................................................................. 22
Logical Operators .................................................................................................................................. 23
Bitwise Operators ................................................................................................................................. 24
Assignment Operators........................................................................................................................... 26
Miscellaneous Operators ...................................................................................................................... 27
Type Operators ..................................................................................................................................... 29
6. ES6 − DECISION MAKING ................................................................................................... 30
The if Statement.................................................................................................................................... 30
The if…else Statement ........................................................................................................................... 32
The else…if Ladder ................................................................................................................................ 33
The switch…case Statement .................................................................................................................. 34
7. ES6 − LOOPS ...................................................................................................................... 38
Definite Loop......................................................................................................................................... 38
Indefinite Loop ...................................................................................................................................... 41
The Loop Control Statements ................................................................................................................ 44
Using Labels to Control the Flow ........................................................................................................... 45
ES6
iv
8. ES6 − FUNCTIONS .............................................................................................................. 49
Classification of Functions ..................................................................................................................... 49
Rest Parameters .................................................................................................................................... 52
Anonymous Function ............................................................................................................................ 52
The Function Constructor ...................................................................................................................... 53
Recursion and JavaScript Functions ....................................................................................................... 54
Lambda Functions ................................................................................................................................. 55
Function Expression and Function Declaration ...................................................................................... 56
Function Hoisting .................................................................................................................................. 57
Immediately Invoked Function Expression ............................................................................................ 57
Generator Functions ............................................................................................................................. 58
9. ES6 − EVENTS .................................................................................................................... 61
Event Handlers ...................................................................................................................................... 61
onclick Event Type ................................................................................................................................. 61
onsubmitEvent Type ............................................................................................................................. 62
onmouseover and onmouseout ............................................................................................................ 63
HTML 5 Standard Events ....................................................................................................................... 63
10. ES6 − COOKIES ................................................................................................................... 70
How It Works?....................................................................................................................................... 70
Storing Cookies ..................................................................................................................................... 70
Reading Cookies .................................................................................................................................... 72
Setting Cookies Expiry Date ................................................................................................................... 73
Deleting a Cookie .................................................................................................................................. 74
11. ES6 − PAGE REDIRECT ........................................................................................................ 76
JavaScript Page Redirection .................................................................................................................. 76
Redirection and Search Engine Optimization ......................................................................................... 77
ES6