For example if I had "scissors" in variable and wanted to know the position of all occurrences of the letter "s", it should print out 1, 4, 5, 8  How can I do this in JavaScript in most efficient way? I don't think looping throu...
Can an array in JavaScript be associative AND indexed?  I'd like to be able to lookup an item in the array by its position or a key value....
I have used vue.js for a couple of projects and I have been using the index as the key in the for loops  <div v-for="(item, index) in items" :key="index"></div>   ...and have started to wonder if there are problems with...
I have a list being dynamically generated and then I click on the item and pass the index() to another function.  The problem is that this list is being populated dynamically and my code does not respond when I do click event. BUT, if I add a couple...
I'm looking for a good open source (with LGPL or a permissive license) indexing engine for a node.js application, something like Lucene. I'm looking for in-process indexing and search and am not interested in indexing servers like Sphinx or...
Assume I have an indexed array of objects, such as these containing lines of a popular folk song ;)  var lyrics = [   {line : 2, words : "He's a lumberjack and he's okay"},   {line : 1, words : "I'm a lumberjack and I'm ok...
I am using AngularJS and its ng-repeat directive to display a sequence of questions. I need to number each question starting with 1. How do I display and increment such a counter with ng-repeat? Here is what I have so far:  <ul>     <li ng-r...
I have a for loop which returns an array.  Return:  1st loop: arr[0] arr[1] arr[2] arr[3]   Here the length I get is 4 (Not a problem).  Return:  2nd loop arr[4] arr[5] arr[6] arr[7]  arr[8]    Here the length I get is 9.  What I want here is the act...
I have a regexp:  /(alpha)|(beta)|(gamma)/gi   Some text to match against:  Betamax. Digamma. Alphabet. Hebetation.   The matches are:  beta, gamma, alpha, beta   The values I am looking would be:  1,2,0,1   ...can I ascertain the index of the group...
So I am using Algolia.com to index users for quick searching.  An example object in index:  {     id: 1,     username: "john.doe",     name: "John Doe",     attributes: {         gender: "male",         hair_color: "blonde...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.