Created
May 23, 2016 00:02
-
-
Save pokojt/328efc64c2169031364135c96d462237 to your computer and use it in GitHub Desktop.
Practice JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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