here returns the length of X
const results = "Greeting Message!"; console.log(results.length);
const results = ['computer', 'laptop', 'dvd', 'cd']; console.log(results.length);
Finding Number of Characters in a String
let final_con = ""; let len = final_con.length; console.log(len); final_con = "We love Payment."; len = final_con.length; console.log(len); final_con.length = 5; console.log(final_con);
Return the number of characters in a string:
var userInput = "Greeting Message!"; var n = userInput.length;
var userInput = "Stripe Payment Gateway"; var length = userInput.length; alert( "Length is "+length);
var userInput = " Stripe Payment Gateway Integration using PHP "; document.write("$" + userInput + "$" + "<br>"); document.write("$" + userInput.trimLeft() + "$");
var userInput = " This is a string "; document.write(userInput.toUpperCase());
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.