To generate random string/ characters in JavaScript, use Math.random().