About 354,000 results
Open links in new tab
  1. How to find if an array contains a specific string in …

    Edit 3.5 years later $.inArray is effectively a wrapper for Array.prototype.indexOf in browsers that support it (almost all of them these days), while providing a shim in those that don't. It is …

  2. Loop through an array in JavaScript - Stack Overflow

    Jun 10, 2010 · In the case of an array, the callback is passed an array index and a corresponding array value each time. (The value can also be accessed through the this keyword, but …

  3. Convert string array to array in javascript - Stack Overflow

    I wanted to store an array as a data attribute in an HTML element so that I could use it later in the JS. However, such an HTML attribute could only be stored as a string.

  4. javascript - Convert string with commas to array - Stack Overflow

    Depending why you want this, strings and arrays are already very similiar (i.e. string[0] === '0' in your question), in most cases you can treat a string as an array of chars and use array …

  5. javascript - How to search for a string inside an array of strings ...

    After searching for an answer in other posts, I felt I have to ask this. I looked at How do I check if an array includes an object in JavaScript? and Best way to find if an item is in a JavaScript …

  6. What is the way of declaring an array in JavaScript?

    The first way described above does not do what it says it does. It actually creates an array of size 5 (all elements undefined), assigning it to the variable a, and then immediately throws that …

  7. JavaScript array element to string - Stack Overflow

    i have a simple array and i want to generate string which include all the elements of the array, for example: The array is set as follow: array[0] = uri0 array[1] = uri1 array[2] = uri2 And the o...

  8. In JavaScript are strings arrays-like objects? - Stack Overflow

    Nov 17, 2021 · Strings in JavaScript have a length property like arrays, but they don't have methods such as forEach or reduce. Does this mean that strings are array-like objects?

  9. javascript - How can I get a character array from a string? - Stack ...

    Dec 28, 2010 · The .length property of a string measures its length in UTF-16 code units, and when you do someString[i] you get the i th UTF-16 code unit of someString. Consequently, …

  10. How to sort strings in JavaScript - Stack Overflow

    I have a list of objects I wish to sort based on a field attr of type string. I tried using - list.sort(function (a, b) { return a.attr - b.attr }) but found that - doesn't appear to work with …

Refresh