Created
September 25, 2023 12:07
-
-
Save sharmaabhinav/f58616162f789f959169d17f1a749a7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const s = " abhinav sharma. " | |
console.log( | |
s.at(0), | |
s.charAt(0), | |
s.charCodeAt(0), | |
s.startsWith("abhi"), | |
s.concat("defghi"), | |
s.endsWith("rma"), | |
String.fromCharCode(98), | |
s.includes("hinav"), | |
s.indexOf("a"), | |
s.lastIndexOf("a"), | |
s.repeat(3), | |
s.split(" "), | |
s.slice(-5, -1), | |
s.trim().length, | |
s.trimStart(), | |
s.trimEnd() | |
) | |
const hour = "2" | |
const minute = "45" | |
console.log( | |
`${hour.padStart(2, "0")}:${minute.padStart(2, "0")}` | |
) | |
const originalText = "The quick brown fox jumped over the monkey and the monkey had last laugh" | |
console.log(originalText.replace("monkey", "lion"), originalText.replaceAll("monkey", "lion")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment