Answers for "JavaScript substring() vs slice()"

0

JavaScript substring() vs slice()

const greet = "Hello, World!";

console.log(greet.substring(0, 5)); 
// Output: "Hello"

console.log(greet.slice(0, 5));     
// Output: "Hello"
Posted by: Raja MS on January-13-2024

Code answers related to "Javascript"

Browse Popular Code Answers by Language