About 51 results
Open links in new tab
  1. javascript - How do you get the length of a string using jQuery ...

    Jun 25, 2009 · UTF-16, the string format used by JavaScript, uses a single 16-bit code unit to represent the most common characters, but needs to use two code units for less commonly-used characters, …

  2. Isn't string.length actually a method in JavaScript?

    Jul 16, 2021 · It's easy to think of strings in Javascript as mutable and as such length should be a method, but when you do var a = 'hello'; a += ' hello'; it looks like you can mutate a string, but what's …

  3. How to check string length with JavaScript - Stack Overflow

    Jun 15, 2012 · I want to get the string length when a key is pressed like StackOverflow does. I have tried to do this with onblur, but it's not working. How do I do this?

  4. How does String.length work in JavaScript? - Stack Overflow

    I want to know how is the string length of a string calculated in js. Is is a function call or a class data member. I want to know what happens when we execute the following code : a = 'this is a ...

  5. How to check string length in JavaScript? - Stack Overflow

    Oct 22, 2015 · How can I check the length of in String in JavaScript? Here is a small code example:

  6. javascript - Understanding the .length property - Stack Overflow

    Dec 1, 2019 · JavaScript exhibits zero based indexing, that is, the first element in an array or in a string is at position 0. Therefore, an array or string of length n has elements going from position 0 to n - 1, …

  7. How to trim a string to N chars in Javascript? - Stack Overflow

    How can I, using Javascript, make a function that will trim string passed as argument, to a specified length, also passed as argument. For example: var string = "this is a string"; var length = 6;...

  8. How to display string length in javascript - Stack Overflow

    Oct 19, 2017 · I am new to javascript, and today i was trying my first example as shown below in the code section. I am using an editor called "Free Javascript Editor". when I run the code, the browser …

  9. javascript - How to create a string with n characters? How to create a ...

    You could create an array of length whatver you want and then use the join() method on the array which will make it into a string. Array(number).join(char) this creates an array on size number -1.

  10. javascript - Create a string of variable length, filled with a repeated ...

    The .join() function honors the array length regardless of whether the elements have values assigned, and undefined values are rendered as empty strings. You have to add 1 to the desired length …