Skip to content

Instantly share code, notes, and snippets.

View fazzyA's full-sized avatar

Faiza Aziz Khan fazzyA

View GitHub Profile
@fazzyA
fazzyA / array-methods-filter.js
Created March 26, 2020 21:23
Array method es6 filter
///filter() method find certain items and filter other according to condition you give
const record = ['John', 'Adams', 'faiza'] // let me filter myself out
record.filter((item) => {return item !=='faiza'})
//['John', 'Adams']
@fazzyA
fazzyA / array-methods-map.js
Last active March 26, 2020 21:22
Array mehtods Es6 map()
/// map() goes through every item and return it or perform some function
const array = [2,3,6,9,12];
array.map((item)=>item*item);
//[4, 9, 36, 81, 144] output
const cars = ['toyota', 'alto', 'civic'];
cars.map((item)=>item.toUpperCase())
//['TOYOTA','ALTO','CIVIC'] output
@fazzyA
fazzyA / template-literals.js
Created March 26, 2020 20:52
Template literals
var saying="hello \n I need some juice" // old way
var saying = `hello
I need some juice`; // es6 way
//////////////////////////////////////////////
var firstName = 'Tom';
var lastName = 'Hanks';
var greetings = 'Hi';
var age = '63';
@fazzyA
fazzyA / arrow-func.js
Last active March 26, 2020 20:48
arrow functions
// simple function
function add(a,b){
return a+b
}
//similar arrow function
const add = (a,b) => {
return a+b
}
//shorten it more
const add = (a,b) => a+b