Shorthand 1:

get character from string

Code:

var string1 = "People";
document.getElementById('long1').innerHTML=string1;
var short1 = string1[2];
document.getElementById('short1').innerHTML=short1;

Shorthand 2:

merging arrays

Code:

var array1 = [1,2,3,4]
var newary = [...array1, 5, 6, 7, 8]
document.getElementById('ary1').innerHTML=array1
document.getElementById('ary2').innerHTML=newary

Shorthand 3:

Find min and max of array

Code:

var array2 = [15,-25,0,500,2]
document.getElementById('maxarray').innerHTML=Math.max(...array2)
document.getElementById('minarray').innerHTML=Math.min(...array2)

Shorthand 4:

NOT operator for math.floor()

Code:

var floor = ~~7.3;
document.getElementById('floor').innerHTML=floor

Shorthand 5:

Shorthand exponent

Code:

var expo=15**3
document.getElementById('expo').innerHTML=expo

Shorthand 6:

Repeating a string

Code:

document.getElementById('repeat').innerHTML='Very Nice '.repeat(6);

Shorthand 7:

Swapping variables

Code:

let first = 'I like Javascript';
let second = 64;
[first, second] = [second, first];
document.getElementById('swap').innerHTML= first + " " + second

Shorthand 8:

Assigning multiple variables different values

Code:

let [num1, num2, num3]=[35,62,3]
document.getElementById('num1').innerHTML=num1
document.getElementById('num2').innerHTML=num2
document.getElementById('num3').innerHTML=num3

Shorthand 9:

Assigning multiple variables the same value

Code:

let var1, var2 = "These are two different variables"
document.getElementById('var1').innerHTML=var1
document.getElementById('var2').innerHTML=var2

Shorthand 10:

For loop shorthand

check console log for the loop

Code:

let arr = [5,14, "This is the last shorthand", "This is the last value in the last array of the last shorthand"];
for (const val of arr) {
console.log(val);
}