Javascript is not a framework but It is so important bacacase most javascripted based frameworks use javascript as underling Technology.Javascript is so powerfull language.As the long time before javascript was used for Frontend Development.But nowadays javascript use for backend programming aswell(ex:Node js).So that No need to learn many languauges for the server side programming.As most of the developers use node js for this reason.It is super fast for http request rather than other server programmings.
When firstly introducing era of the javascript was not fully funtionally beneficial.At that time javascript is not supported for inheritance.but javascript version ECMA Script6(ES6) introduced more funtionalities with inheritance.
ECMA script 6 new Feautures
- let and const
- Arrow funtions
- Template literals
- spread operator
- classes
Let
Inorder to declare variables,before we use "var",ECMA 6 version introduced "let" keyword.const
"const" wasnewly introduced.when we declare const at that time we can assign a value it but after that we can't change the value.if we change the value,we will get error.
Arrow Funtion
Arrow Function has immense of power.Before there are two kind of funtions.One is named funtion other is funtion expression.Arrow funtions make great and concise code.
Look at the below example.
Look at the below example.
let authors = [{name: 'wickramasighe', born: 'koggala'}, {name: 'kumarathunge', born: 'Dickwella'}];
let born = author.map( item => item.born );
// ES5 equivalent:
var born = authors.map(function(item) {
return item.born;
});
we will learn this in another post.Because arrow funtions is the heart of the quicker code writings.
Template Literals
Template literals helps create clean string and perform string interpolation.It makes some strange but analyse this using simple example.let name = 'sumudu',
books = 5,
pens = 7,
console.log(`This is ${name}.`);
console.log(`His name ${name} and has ${books} and $(pens) `);
// ES5 equivalent:
console.log('His name is ' + name + ' and has ' + books + ' and ' + +' pens);
so that we dont need to use concatenate operator over again again so that code is more cleaner.
Spread Operator
Spread operator helps to expand arrays values to another array.
let marks = [78, 89, 82];
let all = [...marks, 65]; // [78, 89, 82, 65]
let more = [...marks, 45, ...all]; // [78, 89, 82, 65, 45, 78, 89,82,65]
classes
ES6 version introduce classes.While introducing classes to javascript,javascript become more popular.
class Birds extends Vehicle {
constructor(name) {
super(name);
this.kind = 'bird'
}
}
let birds= new Birds('parrot');
birds.getName(); // 'parrot'
We will deep in to aboves in future posts.

No comments:
Write commentsNew comments are not allowed.