Skip to content

Instantly share code, notes, and snippets.

@paulinhoneto
Last active February 21, 2018 17:22
Show Gist options
  • Save paulinhoneto/c7b6fd30776d9bfa376d726883795b60 to your computer and use it in GitHub Desktop.
Save paulinhoneto/c7b6fd30776d9bfa376d726883795b60 to your computer and use it in GitHub Desktop.
Basics of JavaScript & ES6 Syntax
// Variables and Types
var name = "Paulinho Neto";
var email = "[email protected]";
var age = 42;
var height = 1.74;
var weight = 65.0;
var maritalStatus = true;
var children = 3;
var country = "Brazil"
var formation = "Computer Science";
var university = "Universidade Paulista - 2014-2018";
var course = "Basic of javacript & ES6 syntax";
var favoriteLanguages = ["javascript", "c", "cplus", "python", "ruby", "php"];
var me = {
"name" : name,
"age" : age,
"height" : height,
"weight" : weight,
"maritalStatus" : maritalStatus,
"children" : children
};
/*Scopo of a variable
let a = 1;
console.log(a);
a = 2;
console.log(a);
const b = 3;
console.log(b);
b = 4;
console.log(b);
*/
// basic function
function sum(n1, n2){
return n1+n2;
}
const SCREAMIT = favoriteLanguages.map(function(language){
return language.toUpperCase();
});
//const WHISPERIT = favoriteLanguages.map((language) => {
//return language.toLowerCase();
//});
const WHISPERIT = favoriteLanguages.map(language => language.toLowerCase());
function diff(n1=0, n2=0){
return n1 - n2;
}
let moreLanguages = ["delphi", "assembly", "typescript", "vb"];
//let allLanguages = favoriteLanguages.concat(moreLanguages);
let allLanguages = [...favoriteLanguages, ...moreLanguages];
console.log(allLanguages);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment