how to pad string js
const str1 = '5';
console.log(str1.padStart(2, '0'));
// expected output: "05"
const fullNumber = '2034399002125581';
const last4Digits = fullNumber.slice(-4);
const maskedNumber = last4Digits.padStart(fullNumber.length, '*');
console.log(maskedNumber);
// expected output: "************5581"
Also in JavaScript:
- odoo post template form using js
- append data array javascript
- show image javascript
- reverse string js
- pageyoffset jquery
- singly even magic square creation algorithm
- adding growl delete notifications in vanilla js
- how to connect react to backend
- js string template decimals
- npm ERR! Unexpected end of JSON input while parsing near '...ty":"sha512-2GTXt3b2Q'
- pass argument to event listener javascript
- javascript check undefined or null
- what is angularjs
- ./src/index.js Line 0: Parsing error: Cannot find module '@babel/helper-validator-identifier'
- Vuejs v-model when enter pressed
- electron iframe require is not defined
- javascript iterate through a binary tree
- how to made disktop program on react website
- javascript format date time
- jquery hide()
- sequelize migration add column
- js get element by X Y
- How can I upload files asynchronously
- if undefined angular