calling element with colon in js code example
Example 1: how to replace array element in javascript without mutation
function replaceAt(array, index, value) {
const ret = array.slice(0);
ret[index] = value;
return ret;
}
const newArray = replaceAt(items, index, "J");
Example 2: adding a variable to a string without using + in javascript
let a = 5;
let b = 10;
console.log(`The sum of a and b is ${a+b} and the multiplication is ${a*b}`);
// The sum of a and b is 15 and the multiplication is 50