How to do exponents in JavaScript?

To write exponents in JavaScript, use the ** operator like so: A ** B.

Here's how you do it:

const oneKb = 2 ** 10;

console.log(oneKb); // 1024
Another way is to use the Math.pow function:
const oneKb = Math.pow(2, 10);

console.log(oneKb); // 1024