Answers for "how to find length of string in javascript without using length method"

0

how to find length of string in javascript without using length method

function strLength(s) {
  var length = 0;
  while (s[length] !== undefined){
    length++;
  } 
  return length;
}

console.log(strLength("Hello")); // 5
console.log(strLength("")); // 0
Posted by: Guest on January-05-2021
-1

javascript create string of given length

var str = new Array(len + 1).join( character );
Posted by: Guest on April-05-2020

Code answers related to "how to find length of string in javascript without using length method"

Code answers related to "Javascript"

Browse Popular Code Answers by Language