Finally found out JavaScript Cheatsheet in PDF format :)
Check this 4 JavaScript Cheatsheet in PDF format:
https://buggyprogrammer.com/cheat-sheet-for-javascript
Best Cheat Sheet:
https://websitesetup.org/wp-content/uploads/2020/09/Javascript-Cheat-Sheet.pdf
<script type="text/javascript">
//JS code goes here
</script>
if ((age >= 14) && (age < 19)) { // logical condition
status = "Eligible."; // executed if condition is true
} else { // else block is optional
status = "Not eligible."; // executed if condition is false
}
//get cheatsheet of other languages too
https://github.com/LeCoupa/awesome-cheatsheets/blob/master/languages/javascript.js
https://github.com/mbeaudru/modern-js-cheatsheet
document.getElementById("elementID").innerHTML = "Hello World!";
/* Convenient interactive cheat sheet */ 'https://htmlcheatsheet.com/js/'
/* PDF VERSION */'https://websitesetup.org/wp-content/uploads/2020/09/Javascript-Cheat-Sheet.pdf'
<div id='box1'>
<p>Some example text</p>
</div>
<div id='box2'>
<p>Some example text</p>
</div>
<script type="text/javascript">
//JS code goes here
</script>
<script type="text/javascript">
//JS code goes here
</script>
<script type="text/javascript">
//JS code goes here
</script>
<script type="text/javascript">
//JS code goes here
</script>
dogs.toString(); // convert to string: results "Bulldog,Beagle,Labrador"
dogs.join(" * "); // join: "Bulldog * Beagle * Labrador"
dogs.pop(); // remove last element
dogs.push("Chihuahua"); // add new element to the end
dogs[dogs.length] = "Chihuahua"; // the same as push
dogs.shift(); // remove first element
dogs.unshift("Chihuahua"); // add new element to the beginning
delete dogs[0]; // change element to undefined (not recommended)
dogs.splice(2, 0, "Pug", "Boxer"); // add elements (where, how many to remove, element list)
var animals = dogs.concat(cats,birds); // join two arrays (dogs followed by cats and birds)
dogs.slice(1,4); // elements from [1] to [4-1]
dogs.sort(); // sort string alphabetically
dogs.reverse(); // sort string in descending order
x.sort(function(a, b){return a - b}); // numeric sort
x.sort(function(a, b){return b - a}); // numeric descending sort
highest = x[0]; // first item in sorted array is the lowest (or highest) value
x.sort(function(a, b){return 0.5 - Math.random()}); // random order sort
javascript cheat sheet
<script type="text/javascript">
//JS code goes here
</script>