Skip to content

Instantly share code, notes, and snippets.

@wellingtonpgp
Created January 27, 2018 18:17
Show Gist options
  • Save wellingtonpgp/ee14d6b3cb366cd304dffc89f407430a to your computer and use it in GitHub Desktop.
Save wellingtonpgp/ee14d6b3cb366cd304dffc89f407430a to your computer and use it in GitHub Desktop.
// const myName = 'Well';
// console.log(myName);
// myName = 'Manu';
// console.log(myName);
// function printMyName(name){
// console.log(name);
// }
// printMyName('Well');
// const printMyName = (name) => {
// console.log(name);
// }
// printMyName('Well');
// const printMyName = name => {
// console.log(name);
// }
// printMyName('Well');
// const printMyName = () => {
// console.log('Well');
// }
// printMyName();
// const printMyName = (name, age) => {
// console.log(name, age);
// }
// printMyName('Well', 22);
// const mutiplty = (number) => {
// return number * 2;
// }
// console.log(mutiplty(2));
// const mutiplty = number => number * 2;
// console.log(mutiplty(2));
// class Human {
// constructor(){
// this.gender = 'male';
// }
// printGender(){
// console.log(this.gender);
// }
// }
// class Person extends Human{
// constructor(){
// super();
// this.name = 'Well';
// this.gender = 'female';
// }
// printMyName(){
// console.log(this.name);
// }
// }
// const person = new Person();
// person.printMyName();
// person.printGender();
//Use ES6
// class Human {
// gender = 'male';
// printGender = () => {
// console.log(this.gender);
// }
// }
// class Person extends Human{
// name = 'Well';
// gender = 'female';
// printMyName = () => {
// console.log(this.name);
// }
// }
// const person = new Person();
// person.printMyName();
// person.printGender();
// const numbers = [1,2,3];
// //copiar array ...
// const newNumbers = [...numbers, 4];
// console.log(newNumbers);
// const person = {
// name: 'Well'
// }
// const newPerson = {
// ...person,
// age: 28
// }
// console.log(newPerson);
//spread
// const filter = (...args) => {
// return args.filter(el => el === 'well');
// }
// console.log(filter(1,2,3, 'well'));
//Destructring
// const numbers = [1,2,3];
// [num1, , num3] = numbers;
// console.log(num1, num3);
//Reference and Primitive and Types Refreshsehr
// const number = 1;
// const num2 = number;
// console.log(num2);
// const person = {
// name: 'Well'
// };
// const secondPerson = person;
// person.name = 'Manu';
// console.log(secondPerson);
// const person = {
// name: 'Well'
// };
// const secondPerson = {
// ...person
// };
// person.name = 'Manu';
// console.log(secondPerson);
const numbers = [1,2,3];
const doubleNumArray = numbers.map((num) => {
return num * 2;
});
console.log(numbers);
console.log(doubleNumArray);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment