[Solved] Replace the numbers with *


To replace the last 2 digits with some characters, firstly convert it to a string and then, using the slice() method, append the characters. You can read more about the slice() method in its MDN Documentation.

let numberAsString = Math.random().toString(); //your number as a string
let result = numberAsString.slice(0, -2) + '**'; //cut and append your asterisks

solved Replace the numbers with *