Skip to content

Instantly share code, notes, and snippets.

@pokojt
Created May 23, 2016 00:02
Show Gist options
  • Save pokojt/328efc64c2169031364135c96d462237 to your computer and use it in GitHub Desktop.
Save pokojt/328efc64c2169031364135c96d462237 to your computer and use it in GitHub Desktop.
Practice JS
var rockPaperScissors = function(userInput) {
debugger;
var options = userInput.split("");
var combos =[];
for (var i=0; i<options.length; i++) {
for (var j=0; j<options.length; j++) {
for (var k=0; k<options.length; k++) {
var lilArray = [];
lilArray.push(options[i] + options[j] + options[k]);
combos.push(lilArray);
}
}
}
return combos;
}
$(document).ready(function(){
$("form#factorial").submit(function(event){
var userInput = $("input#userInput").val();
var total = rockPaperScissors(userInput);
$("#results").append("<p>" + total + "</p>");
event.preventDefault();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment