Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #find #length #string #javascript #length #method
ADD COMMENT
Topic
Name
4+7 =