Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript cheatsheet

Finally found out JavaScript Cheatsheet in PDF format :)

Check this 4 JavaScript Cheatsheet in PDF format:
https://buggyprogrammer.com/cheat-sheet-for-javascript
Comment

javascript cheat sheet

Best Cheat Sheet:
https://websitesetup.org/wp-content/uploads/2020/09/Javascript-Cheat-Sheet.pdf
Comment

javascript cheatsheet

//get cheatsheet of other languages too
https://github.com/LeCoupa/awesome-cheatsheets/blob/master/languages/javascript.js
https://github.com/mbeaudru/modern-js-cheatsheet
Comment

list of javascript cheat sheet

.every(n => ...) => Boolean // ie9+
.some(n => ..) => Boolean   // ie9+
Comment

list of javascript cheat sheet

.find(n => ...)  // es6
.findIndex(...)  // es6
Comment

list of javascript cheat sheet

// before -- [_,_,NEW,REF,_,_]
list.splice(list.indexOf(REF), 0, NEW))
Comment

javascript cheatsheet

document.getElementById("elementID").innerHTML = "Hello World!";
Comment

javascript cheat sheet

/* Convenient interactive cheat sheet */ 'https://htmlcheatsheet.com/js/'
/* PDF VERSION */'https://websitesetup.org/wp-content/uploads/2020/09/Javascript-Cheat-Sheet.pdf'
Comment

list of javascript cheat sheet

.filter(n => ...) => array
Comment

JAVASCRIPT CHEATSHEET 1

// STRING
// string[index] - get a certain character of a string
// string.length - return the number of characters in a string
// string.split(' ') - returns an array of words of a string
// string.split('') - returns an array of characters of a string
// string.toLowerCase() - returns a lowercased string
// string.toUpperCase() - returns an uppercased string
// string.includes('subtring') - checks whether a substring exists inside of a string [check the characther case]

// ARRAY
// array[index] - returns a certain value from an array
// array.indexOf('value') - returns the index of the first occurance of that value
// array.length - returns the number of elements in the array
// array.join('') - returns a string of array values
// array.push(value) - adds the value to the end of the array
// array.pop() - removes the value from the end of the array
// array.unshift(value) - adds the value to the start of the array
// array.shift() - removes the value from the start of the array
// array.splice(fromIndex, number_of_elements) - removes the number_of_elements, starting from fromIndex from the array
// array.slice(fromIndex, toIndex) - copies a certain part of the array

// for - looping
const emojis = [ '😀', '😆', '🙃', '😍' ];
const wavingEmojis = [];

for (let i = 0; i < emojis.length; i++) {
   wavingEmojis.push(`👋${emojis[i]}👋`);
}

// forEach - array method for looping
emojis.forEach((emoji) => console.log(emoji));

// map - array method for looping BUT IT HAS RETURNS
const wavingEmojis = emojis.map((emoji) => `👋${emoji}👋`);

// filter
const numbers = [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ];

const numbersBiggerThanFive = numbers.filter((number) => number > 5);

// sort
const numbers = [ 3, 4, 1, 5, 4, 7, 2, 23, 12 ];

const sortFromSmalles = numbers.sort((a, b) => a - b);
const sortFromLargest = numbers.sort((a, b) => b - a);

// VALUE VS REFERENCE (part 1: intro)
// arrays
const numbers = [ 1, 2, 3, 4 ]; // #123asd
const anotherNumbers = numbers; // #123asd

anotherNumbers.push(5);

// objects
const person = { 
    firstName: 'John', 
    lastName: 'Doe' 
};

const anotherPerson = person;

anotherPerson.lastName = 'DOEEEE';

console.log(numbers === anotherNumbers); // true
console.log(person === anotherPerson) // true

// VALUE VS REFERENCE (part 2: CLONING ARRAYS AND OBJECTS)
// SHALLOW CLONING - ONE LEVEL DEEP
const original = [ 1, 2, 3 ];
const newOriginal = [...original];

// DEEP CLONING - TWO LEVELS DEEP
const users = [ { name: 'John', age: 25 }, { name: 'Victor', age: 25 }, { name: 'Adrian', age: 25 } ];
const newUsers = JSON.parse(JSON.stringify(users));
Comment

list of javascript cheat sheet

.map(n => ...)   // ie9+
.reduce((total, n) => total) // ie9+
.reduceRight(...)
Comment

list of javascript cheat sheet

list = [a,b,c,d,e]
Comment

list of javascript cheat sheet

// after -- [_,_,REF,NEW,_,_]
list.splice(list.indexOf(REF)+1, 0, NEW))
Comment

list of javascript cheat sheet

list.push(X)            // list == [_,_,_,_,_,X]
list.unshift(X)         // list == [X,_,_,_,_,_]
list.splice(2, 0, X)    // list == [_,_,X,_,_,_]
Comment

list of javascript cheat sheet

re = list.splice(1)     // re = [b,c,d,e]  list == [a]
re = list.splice(1,2)   // re = [b,c]      list == [a,d,e]
Comment

list of javascript cheat sheet

list.splice(2, 1, X)    // list == [a,b,X,d,e]
Comment

javascript cheat sheet

javascript cheat sheet
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to invoke a function in a class 
Javascript :: scan token test js 
Javascript :: after end time run function 
Javascript :: js undici fetch data async 
Javascript :: get random hsl color js 
Javascript :: nodejs stream pipeline with custom transform 
Javascript :: react three fiber cannon collision 
Javascript :: condition rendering using if-else 
Javascript :: sadd in redis 
Javascript :: Use Prototype To Add A Property To Javascript Class 
Javascript :: bootstrap 5 
Javascript :: change firebase email on login 
Javascript :: js object filter by keys 
Javascript :: javascript break with while Loop 
Javascript :: javascript basic programs 
Javascript :: extract data from pdf nodejs 
Javascript :: react native smart splash screen 
Javascript :: vue js laravel tutorial 
Javascript :: javascript self executing function 
Javascript :: how to create scroll to top button in reactjs example code 
Javascript :: javascript make do while loop 
Javascript :: mongoose array includes 
Javascript :: create react tailwind app 
Javascript :: jetty 
Javascript :: Adding an item to an array 
Javascript :: js toggle div 
Javascript :: random password generator javascript 
Javascript :: close browser tab using jquery 
Javascript :: select all checkbox in angular 
Javascript :: javascript filter 2d array 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =