I have two arrays:  var array1=["A","B","C"];  var array2=["1","2","3"];   How can I set another array to contain every combination of the above, so that:  var combos=["A1","A2","A...
I've seen several similar questions about how to generate all possible combinations of elements in an array. But I'm having a very hard time figuring out how to write an algorithm that will only output combination pairs. Any suggestions would...
var a = [1,3,6,10,-1]; function combinations(array, n) { }  combinations(a, 9) // should return... [[1], [3], [6], [-1], [1,3], [1,6], [1,-1], [3,6], [3,-1], [6, -1], [10, -1], [1,3,-1], [3,6,-1], [1,6,-1], [1,3,6,-1]]   maybe i'm missing some co...
I am working on making a tic-tac-toe game for the science fair and I need help for recognizing all possible ways of finding a win rather than writing all of them down with brute force.  The game mechanics were just started today and I just started le...
Little challenge.    Goal (nodeJS, loop is an * interator function using "yield" strategy)  var str; var minChars = 1; var maxChars = 10; for (str of loop('abcdefghijklmnopqrstuvwxyz',minChars,maxChars)) {     console.log(str); }...
This seems sort of complex so I'll do my best to be as clear as possible.The particular function I'm looking for dynamically creates a money spent | money won chart for a game of gambling.  I have a lottery of sorts that the user can bet on....
I'm trying to create a function in JavaScript that given a string will return an array of all possible combinations of the letters with each used at most once, starting with the shortest. e.g for the string ABC it would return:  A B C AB AC ABC...
I'm writing something that takes a block of text and breaks it down into possible database queries that could be used to find similar blocks of text. (something similar to the "similar questions" list being generated while I type this) Th...
I have several numbers in an array  var numArr = [1, 3, 5, 9];   I want to cycle through that array and multiply every unique 3 number combination as follows:  1 * 3 * 5 =  1 * 3 * 9 =  1 * 5 * 9 =  3 * 5 * 9 =   Then return an array of all the calcu...
I have the following JavaScript object structure:  var options = {     optionOne: [true, false],     optionTwo: [true, false],     optionThree: [         null,         {property1: 9, property2: 7},         {property1: 4, property2: 12},         {prop...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.