reactjs101
從零開始學 ReactJS(ReactJS 101)是一本希望讓初學者一看就懂的 React 中文入門教學書,由淺入深學習 React.js 生態系 (Flux, Redux, React Router, ImmutableJS, React Native, Relay/GraphQL etc.)。
- 4.3k
- JavaScript
- 3 y ago
A ES6-ECMAScript6-ECMAScript2015-tutorial, An introduction to latest JavaScript programming feature/techniques, step-by-step guide to ES6-ECMAScript6-ECMAScript2015 - A future of JavaScript
Repo dinanathsj29/ES6-ECMAScript6-ECMAScript2015-tutorial, read from GitHub 1 min ago. dinanathsj29 has not joined Take My Repo.
dinanathsj29/ES6-ECMAScript6-ECMAScript2015-tutorial is a public repo on GitHub by dinanathsj29. A ES6-ECMAScript6-ECMAScript2015-tutorial, An introduction to latest JavaScript programming feature/techniques, step-by-step guide to ES6-ECMAScript6-ECMAScript2015 - A future of JavaScript. It declares no license on GitHub. Public does not mean open source: without a license, nobody is granted the right to reuse it. It is written mainly in HTML, has 11 stars and last changed on 2019-08-10. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-21.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
ES6-ECMAScript 6-ECMAScript 2015 is the latest version of the specification for JavaScript. Here will meet the future of JavaScript: as JavaScript follows ECMAScript standards. This course takes a look at the latest features of ECMAScript 6 (aka ES6) and how these changes are making JavaScript even more powerful and concise. Will learn/review the new keywords-let const and function/object syntax and shows how the new class, module syntax can be used with JavaScript library like Angular, React, Node. You'll also review the ES6 compiling tool Typescript,Babel and Scratch JS and also use these to make your ES6 code compatible with modern browsers.
ES6-ECMAScript 6-ECMAScript 2015 introduces us to the newest language features that can be used in JavaScript code. Due to this, I assume you have some working knowledge/understanding of JavaScript. If you haven't, will recommend watching JavaScript Essentials Tutorial for beginners. Also, some basic knowledge of HyperText Markup Language (HTML) HTML5 Essentials and CSS3 Fundamentals will likely be useful in your work with ES6. Finally, you will be using a bit of Angular.js, React.js, and Node.js but nothing that requires deep/advanced knowledge.
Hi All, I'm Dinanath Jayaswal, Senior UI/Web Developer and Adobe Certified Expert Professional, I wanna welcome you to ES6-ECMAScript 6-ECMAScript 2015. In this course/tutorial will go over how to start with using the latest ES6 features right with the bang. Will dive into the specifics of ES6 and new features it includes. We'll look at new keywords, syntax, and operators that can be used to simplify code structure. At the end we'll take a look at class, module syntax in ES6 and how that can be used immediately with very popular JavaScript library/frameworks like Angular, React, Node, etc. Let us explore and learn some pretty exciting stuff so let's go ahead and get started with ES6-ECMAScript 6-ECMAScript 2015.
ES6-ECMAScript 6-ECMAScript 2015 will introduce us to the newest language features that can be used in JavaScript code - The Modern JavaScript.
This course is for anyone and everyone, Almost everyone! who is interested in boost skills and further career - by learning new latest programming/coding standards/features/syntaxes/keywords introduced in the latest version of JavaScript to become a hi-tech developer.
1995 - JavaScript invented/created by “Brandan Eich” at Netscape originally named as "LiveScript"1996 - Microsoft has developed new version of JavaScript named as "JScript" for IE-3ECMA (European Computer Manufacturers Association) is the governing body which provides standardization/specification or JavaScript language implementation1997 - ECMAScript 1 released (JavaScript Submitted to ECMAScript)2009 - ECMAScript 5 released (for...each, array method, map, filter)2015 - ECMAScript 6 released (tones of advanced awesome features - let, const, function default parameters, arrow function, classes, template string, new array/object methods)
ES6-ECMAScript 6-ECMAScript 2015 = ES5 + New Awesome FeaturesMost of the features will discuss here are supported in latest version of the major web browsers such as Google Chrome, Mozilla Firefox, Microsoft Edge, Safari, etc.
Check current browser support and compatibility status for ES6:
Note: Internet Explorer does not support ES6/ECMAScript 6.
online transpilers (source-to-source compilers) free of cost which transpile our current ES6 code to ES5 for better browser compatibility without leaving out the benefits of enhanced syntax and capabilities of ES6ES6 code and converting it into ES5, so browsers can read itCoffeeScript and TypeScript to convert code into JavaScriptdoes not supports all latest new features of ES6/ES2015Transpilers - converts ES6/ES2015 code into ES5 (plain JavaScript, browser understandable code)created by Sebastian McKenzie an Australian developer at FacebookReactJS the UI library created by Facebook uses Babel as a preferred tool for transpiling the ES6 features back into ES5 JavaScriptnot to use In Browser Transformer, it will force the browser to convert all of the ES6 to ES5 at run time, which may make our projects run much slowerUnCaught SyntaxError: Unexpected token = <script src="babel.js URL"> and finally register/make it official with <script type="text/babel">Note: Now a days majority of browser supports most of the ES6 features so accordingly as per needs/requirements include Babel or other transpilers in HTML file.
Syntax & Example:
<!DOCTYPE html> <html lang="en"> <head> <!-- include babel library to transpile/convert ES6 code to ES5 --> <script src="../assets/script/babel/babel_browser_5.8.29.min.js"></script> <!-- internal JavaScript - head section --> <script type="text/babel"> // Write all JavaScript code here // ES6 function syntax with default parameter function showFullName(firstName='Dinanath', lastName='Jayaswal') { console.log(firstName + ' '+ lastName); } showFullName(); </script> </head> <body> </body> </html>
Alternatively, install babel with nodejs ie npm package and use respective commands at CLI to transpile ES6 files into ES5.
webpack which helps to automate the process like transpiling, less/sass conversion, script/image/CSS bundling and morenpm initnpm install -g webpacknpm install --save-dev babel-loaderwebpack.config.jswebpackbundle.js filenode -v / npm -vText Editor to write code like VS code, Sublime Text, Adobe Brackets or any one of your choicetranspiler like typescript globally to transpile/convert code into plain JavaScript, by using the command: npm install typescript -gCTRL+SHIFT+B -> Choose Task Runner - > Typescript Watch Mode -> it will create task.jsonSyntax & Example:
task.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "typescript",
"tsconfig": "tsconfig.json",
"option": "watch",
"problemMatcher": [
"$tsc-watch"
]
},
{
"type": "typescript",
"tsconfig": "tsconfig.json",
"problemMatcher": [
"$tsc"
]
}
]
}tsconfig.json file) by using the command: tsc --init
"sourceMap": true, - map files helps to debug (.ts to .js mapping)"outDir": "./scripts", - typescript transpiler will generate/organize all .js files into scripts folderSyntax & Example:
tsconfig.json
{
"compilerOptions": {
/* Basic Options */
"target": "es5",
"module": "commonjs",
"outDir": "./scripts",
"strict": true,
"esModuleInterop": true
}
}Syntax & Example:
Typescript 3_6_es6_ts_transpiling.ts
// by default typescript consider all files in a folder as a module, so variables defined in one file will be checked on the fly and throws an error: Cannot redeclare block-scoped variable - to solve issue use export {} // export {}; console.log('Welcome to ES6'); let firstName: string = 'Dinanath'; let lastName: string = 'Jayaswal'; const country: string = 'India' let isMale: boolean = true; console.log(firstName + ' ' + lastName); // ES6 function syntax with default parameter function showFullName(_firstName = 'Dinanath', _lastName = 'Jayaswal') { console.log(_firstName + ' ' + _lastName); } showFullName();
tsc -vtsc -h or tsc --helptsc fileName.tstsc filename.ts --watch or to watch all files at once type command: tsc --watchSyntax & Example:
Typescript code converted to JavaScript 3_6_es6_ts_transpiling.js
"use strict"; // by default typescript consi: stringder all files in a folder as a module, so variables defined in one file will be checked on the fly and throws error: Cannot redeclare block-scoped variable - to solve issue use export {} // export {}; console.log('Welcome to ES6'); var firstName = 'Dinanath'; var lastName = 'Jayaswal'; var country = 'India'; var isMale = true; console.log(firstName + ' ' + lastName); // ES6 function syntax with default parameter function showFullName(_firstName, _lastName) { if (_firstName === void 0) { _firstName = 'Dinanath'; } if (_lastName === void 0) { _lastName = 'Jayaswal'; } console.log(_firstName + ' ' + _lastName); } showFullName(); //# sourceMappingURL=3_6_es6_ts_transpiling.js.map
index.html file and include newly created .js file with script tag to check and verify the outputSyntax & Example: index.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- internal style --> <style> /* css selector: { property:value; } */ body { font-family: arial; } </style> <title>3_6_es6_ts_transpiling</title> <script src="./scripts/3_6_es6_ts_transpiling.js"></script> </head> <body> <h1>Working with ES6 & Typescript features</h1> </body> </html>
serve, HTTP, lite-server, static etc
npm install lite-server -glite-server and check the output in the browserGoogle Chrome Extention named Scratch JS, an add-on for DevTools which integrates both the Traceur and Babel transpilers, allowing us to test out the new JS features coming with ES6/ES2015Scratch JS also supports CoffeeScript, LiveScript and more compile-to-JS languages will be added soonScratch JS as a Google Chrome Extention:
Hoisting - Behind the scene JavaScript declare variables at the topFunctional scope - var keyword got functional scope (accessible through-out the function body), at the same time var keyword variables also get hoistedLet keyword block scope - let keyword variables exist only inside block { }scope, but never hoistedSyntax & Example:
Typescript 4_1_es6_ts_var_hoisting.ts
// by default typescript consider all files in a folder as a module, so variables defined in one file will be checked on the fly and throws an error: Cannot redeclare block-scoped variable - to solve issue use export {} // export {}; greetUser1('Dinanath1'); //hoising funciton declaration will move to top function greetUser1(userName1: string) { if (userName1 === 'Dinanath1') { var greetings1 = 'Hello Dinanath, Welcome'; } else { var greetings1 = 'Hello Guest'; } console.log(greetings1); //var variables available outside as it have functional scope var greetings1: string; //hoisting variable declaration will move to top } greetUser1('Dinanath2');
Syntax & Example:
JavaScript 4_1_es6_ts_var_hoisting.js
"use strict"; // by default typescript consider all files in a folder as a module, so variables defined in one file will be checked on the fly and throws error: Cannot redeclare block-scoped variable - to solve issue use export {} // export {}; greetUser1('Dinanath1');//hoising funciton declaration will move to top function greetUser1(userName1) { if (userName1 === 'Dinanath1') { var greetings1 = 'Hello Dinanath, Welcome'; } else { var greetings1 = 'Hello Guest'; } console.log(greetings1); //var variables available outside as it have functional scope var greetings1; //hoisting variable declaration will move to top } greetUser1('Dinanath2'); //# sourceMappingURL=4_1_es6_ts_var_hoisting.js.map
deal with scope in JavaScript we have new keyword named let used to declare variablescreate block scoping in JavaScript in locations where we weren't able to do so beforeLet keyword block scope - let keyword variables exist only inside block { }scopenever hoisted)cannot be re-declaredSyntax & Example:
Typescript 4_2_es6_ts_let.ts
// by default typescript consider all files in a folder as a module, so variables defined in one file will be checked on the fly and throws an error: Cannot redeclare block-scoped variable - to solve issue use export {} // export {}; function greetUser1(userName1: string) { if (userName1 === 'Dinanath1') { var greetings1 = 'Hello Dinanath, Welcome'; } else { var greetings1 = 'Hello Guest'; } console.log(greetings1); //var variables available outside as it have functional scope var greetings1: string; //hoisting variable declaration will move to top } greetUser1('Dinanath1'); // ------------------------------ /* function greetUser2(userName2:string){ if(userName2 === 'Dinanath2'){ let greetings2 = 'Hello Dinanath2'; }else{ let greetings2 = 'Hello Guest'; } console.log(greetings2); //error - let variables not available out side block } */ function greetUser2(userName2: string) { let greetings2 if (userName2 === 'Dinanath2') { greetings2 = 'Hello Dinanath2'; } else { greetings2 = 'Hello Guest'; } console.log(greetings2); } greetUser2('Dinanath2'); // ------------------------------ var num1: number = 10; var num2: number = 20; if (num1 === 10) { var num1: number = 100; let num2: number = 200; console.log('inside num1 : ' + num1); console.log('inside num2 : ' + num2); } console.log('outside num1 : ' + num1); console.log('outside num2 : ' + num2); // ------------------------------ // let variables not hoisted /* function greetUser3(userName3:string){ if(userName3 === 'Dinanath3'){ greetings3 = 'Hello Dinanath3'; //error - let variables not hoisted }else{ greetings3 = 'Hello Guest'; //error - let variables not hoisted } console.log(greetings3); //error - let variables not hoisted let greetings3; } */ // ------------------------------ // let variables not be re-declared // var firstName: string = 'Dinanath'; //error // var firstName: string = 'DJ'; //error let fName; // let fName; //cannot redeclare block-scoped variable 'fName'
Syntax & Example:
JavaScript 4_2_es6_ts_let.js
"use strict"; // by default typescript consider all files in a folder as a module, so variables defined in one file will be checked on the fly and throws error: Cannot redeclare block-scoped variable - to solve issue use export {} // export {}; function greetUser1(userName1) { if (userName1 === 'Dinanath1') { var greetings1 = 'Hello Dinanath, Welcome'; } else { var greetings1 = 'Hello Guest'; } console.log(greetings1); //var variables available outside as it have functional scope var greetings1; //hoisting variable declaration will move to top } greetUser1('Dinanath1'); // ------------------------------ /* function greetUser2(userName2:string){ if(userName2 === 'Dinanath2'){ let greetings2 = 'Hello Dinanath2'; }else{ let greetings2 = 'Hello Guest'; } console.log(greetings2); //error - let variables not available out side block } */ function greetUser2(userName2) { var greetings2; if (userName2 === 'Dinanath2') { greetings2 = 'Hello Dinanath2'; } else { greetings2 = 'Hello Guest'; } console.log(greetings2); } greetUser2('Dinanath2'); // ------------------------------ var num1 = 10; var num2 = 20; if (num1 === 10) { var num1 = 100; var num2_1 = 200; console.log('inside num1 : ' + num1); console.log('inside num2 : ' + num2_1); } console.log('outside num1 : ' + num1); console.log('outside num2 : ' + num2); // ------------------------------ // let variables not hoisted /* function greetUser3(userName3:string){ if(userName3 === 'Dinanath3'){ greetings3 = 'Hello Dinanath3'; //error - let variables not hoisted }else{ greetings3 = 'Hello Guest'; //error - let variables not hoisted } console.log(greetings3); //error - let variables not hoisted let greetings3; } */ // ------------------------------ // let variables not be re-declared // var firstName: string = 'Dinanath'; //error // var firstName: string = 'DJ'; //error var fName; // let fName; //cannot redeclare block-scoped variable 'fName' //# sourceMappingURL=4_2_es6_ts_let.js.map
closures and loops its advisable to use let instead of varSyntax & Example:
Typescript 4_3_es6_ts_let_loop.ts
// export {}; for (var i = 1; i <= 5; i++) { setTimeout(() => { console.log('var based for loop', i); //6 }, 1000); } // ------------------------------ for (let j = 1; j <= 5; j++) { setTimeout(() => { console.log('let based for loop', j); //1,2,3,4,5 }, 1000); }
Syntax & Example:
JavaScript 4_3_es6_ts_let_loop.js
"use strict"; // export {}; for (var i = 1; i <= 5; i++) { setTimeout(function () { console.log('var based for loop', i); //6 }, 1000); } var _loop_1 = function (j) { setTimeout(function () { console.log('let based for loop', j); //1,2,3,4,5 }, 1000); }; // ------------------------------ for (var j = 1; j <= 5; j++) { _loop_1(j); } //# sourceMappingURL=4_3_es6_ts_let_loop.js.map
"immutable variables"),const an alternative for declaring variablesconstant allows us to set constant variables which shouldn't be reassignedfixed set of values also to protect the values of certain variablesTypeError, SyntaxErrorvariable with read-only constantswhile declaration/initializednot to change/re-assigned in futureblock scopenever hoistedSyntax & Example:
Typescript 4_4_1_ts_const_var.ts
// export {}; let firstName //const firstName1; //error - const must have some value `while declaration/initialized` const lastName = 'Jayaswal'; // const lastName //error - const value is fixed, `not to change/re-assigned` in future console.log(firstName); console.log(lastName);
Syntax & Example:
JavaScript 4_4_1_ts_const_var.js
"use strict"; // export {}; var firstName; //const firstName1; //error - const must have some value `while declaration/initialized` var lastName = 'Jayaswal'; // const lastName //error - const value is fixed, `not to change/re-assigned` in future console.log(firstName); console.log(lastName); //# sourceMappingURL=4_4_1_ts_const_var.js.map
Syntax & Example:
Typescript 4_4_2_ts_const_array.ts
// export {}; const PersonArray = ['Dinanath', 'Jayaswal', 35, 'Male', true]; console.log(PersonArray[0]); // we can re-assign value PersonArray[0] = 'Vedika'; console.log(PersonArray[0]); //error - we cannot re-assign new array /* PersonArray = { }*/
Syntax & Example:
JavaScript 4_4_2_ts_const_array.js
"use strict"; // export {}; var PersonArray = ['Dinanath', 'Jayaswal', 35, 'Male', true]; console.log(PersonArray[0]); // we can re-assign value PersonArray[0] = 'Vedika'; console.log(PersonArray[0]); //error - we cannot re-assign new array /* PersonArray = { }*/ //# sourceMappingURL=4_4_2_ts_const_array.js.map
Syntax & Example:
Typescript 4_4_3_ts_const_object.ts
// export {}; const Person = { firstName: 'Dinanath', lastName: 'Jayaswal', age: 35, gender: 'Male', isMale: true } console.log(Person.firstName); // we can re-assign value Person.firstName = 'Vedika'; console.log(Person.firstName); //error - we cannot re-assign new object /* Person = { } */
Syntax & Example:
JavaScript 4_4_3_ts_const_object.js
"use strict"; // export {}; var Person = { firstName: 'Dinanath', lastName: 'Jayaswal', age: 35, gender: 'Male', isMale: true }; console.log(Person.firstName); // we can re-assign value Person.firstName = 'Vedika'; console.log(Person.firstName); //error - we cannot re-assign new object /* Person = { } */ //# sourceMappingURL=4_4_3_ts_const_object.js.map
one time assignments (fixed value, not changed in future) use constvalue updation requires use letconst name='Dinanath';let name;immutable, not changeable variablesmutable, can be changed or re-assignedArrow functions also called fat arrow functions, have an abbreviated syntax for working with functions with the equal sign and the greater than symbolfat arrow functions provide syntactical sugar so that we can shorten old function definition, make it more readable and compactprovides short/concise syntax/way of writing functions, uses fewer lines of codesimplified behavior of this keyword in JavaScriptSyntax & Example:
Typescript 5_1_es6_ts_fat_arrow_function.ts
// export {}; //normal function var getNormalValue = function () { return 100; } console.log('normal function return', getNormalValue()); // ------------------------------ //arrow function const getArrowValue1 = () => { return 200; } console.log('fat arrow function return', getArrowValue1()); // ------------------------------ //arrow function - single line return var getArrowValue2 = () => 500; console.log('fat arrow function single line return', getArrowValue2()); // ------------------------------ //arrow function - parameter var getArrowValue3 = (num: number) => num; console.log('fat arrow function parameter', getArrowValue3(10)); // ------------------------------ console.log('type of getArrowValue2', typeof getArrowValue2);
Syntax & Example:
JavaScript 5_1_es6_ts_fat_arrow_function.js
"use strict"; // export {}; //normal function var getNormalValue = function () { return 100; }; console.log('normal function return', getNormalValue()); // ------------------------------ //arrow function var getArrowValue1 = function () { return 200; }; console.log('fat arrow function return', getArrowValue1()); // ------------------------------ //arrow function - single line return var getArrowValue2 = function () { return 500; }; console.log('fat arrow function single line return', getArrowValue2()); // ------------------------------ //arrow function - parameter var getArrowValue3 = function (num) { return num; }; console.log('fat arrow function parameter', getArrowValue3(10)); // ------------------------------ console.log('type of getArrowValue2', typeof getArrowValue2); //# sourceMappingURL=5_1_es6_ts_fat_arrow_function.js.map
this scope / lexical thisthis keyword in our JavaScript codenormal JavaScript function context creates their own scope thisdoes not create own scope for 'this', but refers to its parents thisSyntax & Example:
Typescript 5_2_es6_ts_fat_arrow_function_this_scope.ts
// export {}; var EmployeeObj1 = { empId1: 111, greetings1: function () { console.log('this.empId1 : ' + this.empId1); } } EmployeeObj1.greetings1(); // empId1: 111, // ------------------------------ //error - internal function 'this' scope created /* var EmployeeObj2 = { empId2: 222, greetings2: function () { setTimeout(function () { console.log('this.empId2 : ' + this.empId2); }, 1000) } } EmployeeObj2.greetings2(); */ // ------------------------------ //internal function 'this' scope created, work around with 'self' var EmployeeObj3 = { empId3: 333, greetings3: function () { var self = this; setTimeout(function () { console.log('self.empId3 : ' + self.empId3); }, 1000) } } EmployeeObj3.greetings3(); // empId3: 333, // ------------------------------ //best work around with fat arrow function => var EmployeeObj4 = { empId4: 444, greetings4: function () { setTimeout(() => { console.log('this.empId4 : ' + this.empId4); }, 1000) } } EmployeeObj4.greetings4(); // empId4: 444,
Syntax & Example:
JavaScript 5_2_es6_ts_fat_arrow_function_this_scope.js
"use strict"; // export {}; var EmployeeObj1 = { empId1: 111, greetings1: function () { console.log('this.empId1 : ' + this.empId1); } }; EmployeeObj1.greetings1(); // empId1: 111, // ------------------------------ //error - internal function 'this' scope created /* var EmployeeObj2 = { empId2: 222, greetings2: function () { setTimeout(function () { console.log('this.empId2 : ' + this.empId2); }, 1000) } } EmployeeObj2.greetings2(); */ // ------------------------------ //internal function 'this' scope created, work around with 'self' var EmployeeObj3 = { empId3: 333, greetings3: function () { var self = this; setTimeout(function () { console.log('self.empId3 : ' + self.empId3); }, 1000); } }; EmployeeObj3.greetings3(); // empId3: 333, // ------------------------------ //best work around with fat arrow function => var EmployeeObj4 = { empId4: 444, greetings4: function () { var _this = this; setTimeout(function () { console.log('this.empId4 : ' + _this.empId4); }, 1000); } }; EmployeeObj4.greetings4(); // empId4: 444, //# sourceMappingURL=5_2_es6_ts_fat_arrow_function_this_scope.js.map
default value to Parametersarguments.length, default value is not considered/counted, only actual passed arguments countedSyntax & Example:
Typescript 6_1_es6_ts_parameters_default_value.ts
// export {}; //normal function call /* let showValue1 = function (value1) { console.log(value1); } showValue1(); //undefined - as no parameters passed */ // ------------------------------ let showValue2 = function (value2 = 20) { console.log(value2); console.log(arguments.length); console.log('// ------------------------------'); } showValue2(); // 20 showValue2(200); // 200 // ------------------------------ let showValue3 = function (value3 = 20, value4 = value3 + 10) { console.log(value3); console.log(value4); console.log(value3, value4); console.log(arguments.length); console.log('// ------------------------------'); } showValue3(); // value3=20, value4=30, value3 20, value4 30, arguments.length 0 console.log('// 1 ------------------------------'); showValue3(200); console.log('// 2 ------------------------------'); showValue3(200, 300); console.log('// 3 ------------------------------');
Syntax & Example:
JavaScript 6_1_es6_ts_parameters_default_value.js
"use strict"; // export {}; //normal function call /* let showValue1 = function (value1) { console.log(value1); } showValue1(); //undefined - as no parameters passed */ // ------------------------------ var showValue2 = function (value2) { if (value2 === void 0) { value2 = 20; } console.log(value2); console.log(arguments.length); console.log('// ------------------------------'); }; showValue2(); // 20 showValue2(200); // 200 // ------------------------------ var showValue3 = function (value3, value4) { if (value3 === void 0) { value3 = 20; } if (value4 === void 0) { value4 = value3 + 10; } console.log(value3); console.log(value4); console.log(value3, value4); console.log(arguments.length); console.log('// ------------------------------'); }; showValue3(); // value3=20, value4=30, value3 20, value4 30, arguments.length 0 console.log('// 1 ------------------------------'); showValue3(200); console.log('// 2 ------------------------------'); showValue3(200, 300); console.log('// 3 ------------------------------'); //# sourceMappingURL=6_1_es6_ts_parameters_default_value.js.map
indefinite number of arguments as an array...arrayName - is used to convert the individual item into an arraymultiple arguments of the same type)rest operator (...) i.e. three dotsSyntax & Example:
Typescript 6_2_es6_ts_parameters_rest_operator.ts
// export {}; // es5 normal function let displayColors = function () { for (let i in arguments) { console.log('arguments color list:', arguments[i]); } } displayColors('cyan'); console.log('------------------------------'); displayColors('cyan', 'magenta'); console.log('------------------------------'); displayColors('cyan', 'magenta', 'yellow'); console.log('------------------------------'); console.log('// ------------------------------'); // es6 rest operator let showColors = function (...colorsList) { console.log('colorsList rest operator:', colorsList); console.log('arguments.length:', arguments.length); for (let i in colorsList) { console.log('colorsList rest operator array loop:', colorsList[i]); } console.log('// '); } showColors('red'); showColors('red', 'green'); showColors('red', 'green', 'blue');
Syntax & Example:
JavaScript 6_2_es6_ts_parameters_rest_operator.js
"use strict"; // export {}; // es5 normal function var displayColors = function () { for (var i_1 in arguments) { console.log('arguments color list:', arguments[i_1]); } }; displayColors('cyan'); console.log('------------------------------'); displayColors('cyan', 'magenta'); console.log('------------------------------'); displayColors('cyan', 'magenta', 'yellow'); console.log('------------------------------'); console.log('// ------------------------------'); // es6 rest operator var showColors = function () { var colorsList = []; for (var _i = 0; _i < arguments.length; _i++) { colorsList[_i] = arguments[_i]; } console.log('colorsList rest operator:', colorsList); console.log('arguments.length:', arguments.length); for (var i_2 in colorsList) { console.log('colorsList rest operator array loop:', colorsList[i_2]); } console.log('// '); }; showColors('red'); showColors('red', 'green'); showColors('red', 'green', 'blue'); //# sourceMappingURL=6_2_es6_ts_parameters_rest_operator.js.map
split/convert an array into individual item/stringcombine, Spread operator is to splitSyntax & Example:
Typescript 6_3_es6_ts_spread_operator.ts
// export {}; let colorsList = ['red', 'green', 'blue', 'black']; let showColors = function (...colors) { console.log('spread operator:', colors); console.log('arguments.length', arguments.length); for (let color in colors) { console.log('colorsList:', colors[color]); } } showColors(...colorsList); console.log('Elements in the colors List:', ...colorsList);
Syntax & Example:
JavaScript 6_3_es6_ts_spread_operator.js
"use strict"; // export {}; var colorsList = ['red', 'green', 'blue', 'black']; var showColors = function () { var colors = []; for (var _i = 0; _i < arguments.length; _i++) { colors[_i] = arguments[_i]; } console.log('spread operator:', colors); console.log('arguments.length', arguments.length); for (var color in colors) { console.log('colorsList:', colors[color]); } }; showColors.apply(void 0, colorsList); console.log.apply(console, ['Elements in the colors List'].concat(colorsList)); //# sourceMappingURL=6_3_es6_ts_spread_operator.js.map
Syntax & Example:
Typescript 7_1_es6_ts_object_property_shorthand.ts
// export {}; //old plain javascript approach let firstName = 'angular'; let lastName = 'typescript'; let Technology = { //new property : variable firstName: firstName, lastName: lastName } console.log(Technology.firstName); console.log(Technology.lastName); console.log('// ------------------------------'); // ------------------------------ //ES6 approach - When property names are similar/equivalent to variable name than ES6 provides a shorthand notation for object literals let version1 = 7; let version2 = 3; let newTechnology = { firstName, lastName, version1, version2 } console.log(newTechnology.firstName); console.log(newTechnology.lastName); console.log(newTechnology.version1); console.log(newTechnology.version2); console.log('// ------------------------------');
Syntax & Example:
JavaScript 7_1_es6_ts_object_property_shorthand.js
"use strict"; // export {}; //old plain javascript approach var firstName = 'angular'; var lastName = 'typescript'; var Technology = { //new property : variable firstName: firstName, lastName: lastName }; console.log(Technology.firstName); console.log(Technology.lastName); console.log('// ------------------------------'); // ------------------------------ //ES6 approach - When property names are similar/equivalent to variable name than ES6 provide shorthand notation for object literals var version1 = 7; var version2 = 3; var newTechnology = { firstName: firstName, lastName: lastName, version1: version1, version2: version2 }; console.log(newTechnology.firstName); console.log(newTechnology.lastName); console.log(newTechnology.version1); console.log(newTechnology.version2); console.log('// ------------------------------'); //# sourceMappingURL=7_1_es6_ts_object_property_shorthand.js.map
'first name': dinanath,.DOT notation use square brackets ['first name']Syntax & Example:
Typescript .ts
//In ES6 we can use property names with space like 'first name' let lastName = 'last name'; let Employee = { 'first name': 'Dinanath', [lastName]:'Jayaswal' } console.log(Employee['first name']); console.log(Employee['last name']); console.log(Employee);
Syntax & Example:
JavaScript .js
"use strict"; //In ES6 we can use property names with space like 'first name' var Employee = { 'first name': 'Dinanath', }; console.log(Employee['first name']); //# sourceMappingURL=7_2_es6_ts_object_property_name.js.map
Strings Template offers a convenient way to work with string concatenation/interpolationback-tick (grave accent) character and { var name in curly brace }, no + plus sign requireduse 'single' "double" quotes insideSyntax & Example:
Typescript 8_1_es6_ts_template_strings_literals_interpolation.ts
// export {}; //old plain javascript approach let user = 'Dinanath'; let greetMessage1 = 'Welcome' + ' ' + user + ' ' + 'to ES6.'; console.log(greetMessage1); console.log('// ------------------------------'); //ES6 Template Literals (Template Strings) approach let greetMessage2 = `Welcome ${user} to ES6.`; console.log(greetMessage2); console.log('// ------------------------------'); // ------------------------------ //ES6 multi-line string let greetMessage3 = `ES6 Template Literals (Template Strings): With Template Literals (Template Strings) we can add multiple lines in string concatenation/interpolation `; console.log(greetMessage3);
Syntax & Example:
JavaScript 8_1_es6_ts_template_strings_literals_interpolation.js
"use strict"; // export {}; //old plain javascript approach var user = 'Dinanath'; var greetMessage1 = 'Welcome' + ' ' + user + ' ' + 'to ES6.'; console.log(greetMessage1); console.log('// ------------------------------'); //ES6 Template Literals (Template Strings) approach var greetMessage2 = "Welcome " + user + " to ES6."; console.log(greetMessage2); console.log('// ------------------------------'); // ------------------------------ //ES6 multi-line string var greetMessage3 = "ES6 Template Literals (Template Strings):\n With Template Literals (Template Strings)\n we can add mutiple lines in string concatenation/interpolation\n"; console.log(greetMessage3); //# sourceMappingURL=8_1_es6_ts_template_strings_literals_interpolation.js.map
Syntax & Example:
Typescript 9_1_es6_ts_destructuring_array.ts
// export {}; //old plain javascript approach let arrEmployee = ['Dinanath', 'Jayaswal', 'Male', 35, true]; console.log(arrEmployee[0]); console.log(arrEmployee[1]); console.log('// ------------------------------'); //ES6 Destructuring approach //assign a meaningful name to each positions value let [first, second, third, fourth, fifth] = arrEmployee; let [firstName, lastName, gender, age, isSenior] = arrEmployee; console.log(first); console.log(second); console.log(gender); console.log(age); console.log('// ------------------------------'); let [fn, ln, , , senior] = arrEmployee console.log(fn); console.log(senior); // ------------------------------
Syntax & Example:
JavaScript 9_1_es6_ts_destructuring_array.js
"use strict"; // export {}; //old plain javascript approach var arrEmployee = ['Dinanath', 'Jayaswal', 'Male', 35, true]; console.log(arrEmployee[0]); console.log(arrEmployee[1]); console.log('// ------------------------------'); //ES6 Destructuring approach //assign a meaningful name to each positions value var first = arrEmployee[0], second = arrEmployee
dinanathsj29/ES6-ECMAScript6-ECMAScript2015-tutorial is a public repo on GitHub by dinanathsj29. A ES6-ECMAScript6-ECMAScript2015-tutorial, An introduction to latest JavaScript programming feature/techniques, step-by-step guide to ES6-ECMAScript6-ECMAScript2015 - A future of JavaScript.
It declares no license on GitHub. Public does not mean open source: without a license, nobody is granted the right to reuse it.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.

從零開始學 ReactJS(ReactJS 101)是一本希望讓初學者一看就懂的 React 中文入門教學書,由淺入深學習 React.js 生態系 (Flux, Redux, React Router, ImmutableJS, React Native, Relay/GraphQL etc.)。

Its last change on GitHub was on 2019-08-10. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
🔥 Use Vue.js to develop a cross-platform full stack application / 用 Vue.js 开发的跨三端应用

Код учебного курса “ES6” на YouTube-канале webDev (https://tinyurl.com/62udyxnw)


A JavaScript tutorials for beginners, An introduction to JavaScript programming languages building blocks, step-by-step guide to JavaScript

Lets go-through, learn and understand different logical Javascript exercises and algorithms for beginners.

A HTML5 tutorials for beginners, An introduction to HTML5 building blocks, step-by-step guide to HTML5

A Web concepts tutorials for beginners, An introduction to Web Design Development core terminologies and fundamentals
A Typescript fundamentals tutorials for beginners, An introduction & step-by-step guide to Typescript language latest features in combination with ECMAScript 5,6,7
Learn to write Unit Testing and Integration Testing of Angular application for multiple types of components, directives, dependencies, routers and services.
This page is also available as structured data, with the same sources and dates.
/api/v1/resources/gh/dinanathsj29/ES6-ECMAScript6-ECMAScript2015-tutorialTake My Repo has not tested this on your machine. Requirements come from the project's own documentation.
