Маски номера с падстартом

/*
	The padStart() method in JavaScript is used to pad a string with 
    another string until it reaches the given length. 
    The padding is applied from the left end of the string.
*/

const cardNumber = '3486545338413697'; // ATM Card Digits
const last4Digits = cardNumber.slice(-4); // Or increment the number to desired digits to be visible
const maskedDigits = last4Digits.padStart(cardNumber.length, '*');

console.log(maskedDigits);
// expected output: "************3697"

// With love @kouqhar
kouqhar