(123456789).toLocaleString() will returns: 123,456,789
.(123).toString().padStart(6, "0") will returns: 000123
.(123).toString().padStart(6) will returns: 123
.("abcde").includes("bc") will returns: true
.["a","b","c"].includes("b") will returns: true
."abcde".startsWith("abc") will returns: true
."abcde".endsWith("cde") will returns: true
.(new Date()).toString().includes("Malaysia") will returns: true if the visitor is Malaysian.
// ENTER SETUP
// ===========
let t = "hello world";
// LEAVE SETUP
// ===========
let ss = window.speechSynthesis;
let voices = [];
ss.onvoiceschanged = ()=>{
voices = ss.getVoices();
};
voices = ss.getVoices();
let ssu = new SpeechSynthesisUtterance(t);
ssu.voice = voices[0];
ss.speak(ssu);
.
document.addEventListener("DOMContentLoaded", (ev)=>{
console.log("DOM fully loaded and parsed");
});
.
history.go();
.
(.*?) and do action on the captured group:
function replacer(match, capture1, offset, original_string) {
let n = parseFloat(capture1);
return "output: " + n*2;
}
let s = "[tag]3[/tag]";
s.replace(/\[tag\](.*?)\[\/tag\]/gi, replacer);
will returns: output: 6.
Search the entire website: