JavaScript Strings Part – 3
Full Stack Web Development Courses with Real-time projects Start Now!!
Program 1
// String in Java Script Slice and templates
"use strict"
const ps=require("prompt-sync")
const prompt=ps({sigint:true})
let ch=prompt("Enter a character: ")
let asci=ch.charCodeAt(0)
console.log(`Character value is ${ch} and Ascii value is ${asci}`)
// let a,b,c
// a=parseInt(prompt("Enter First Number"))
// b=parseInt(prompt("Enter First Number"))
// c=a+b
// console.log(`Addition of ${a} and ${b} is ${c}`)
// let s= ` Data Flair
// Java Script
// Course
// its a Simple
// Language`
// console.log(s)
// let s="This is a java script course and java script is simple"
// console.log(s.substring(5)) // index 5 to 10
// console.log(s.slice(5)) // index 5 to 10
// console.log(s.substr(5)) // from index 5 to next 10
/*
substring()
slice()
substr()
*/
If you are Happy with DataFlair, do not forget to make us happy with your positive feedback on Google

