Skip to content

michaelambass/es6-notes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

ES6 (ECMAScript 6) Javascript - notes

## Variables var : scoped to the nearest function block (global if outside any block)

let : scoped to the nearest enclosing block (global if outside any block)

const : scoped as let but not editable

## Arrow functions ### Function without parameters

const getMyName = () => `Michael`;
console.log(getMyName());

Function with 1 parameter

const setMyName = (name) => name;
console.log(setMyName('Michael Ambass'));

### Function with multiple parameters

const setMyFullname = (firstname, lastname) => firstname + ' ' + lastname;
console.log(setMyFullname('Michael', 'Ambass'));

### Return VS execution The value is automatically returned when there is no brackets.

Example with return

const getMyName = () => `Michael Ambass`;

#### Example with code execution

const getMyName = () => {

	// executed code
  	console.log('Michael Ambass');
}

getMyName();

About

Notes about ES6 (ECMAScript 6) - Javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published