Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Help a JS virgin find that sweet spot

Name: Anonymous 2012-11-13 1:47

I'm practicing JS by trying to make a rock, paper, scissor game. 

I have failed.

Can /prog/ help a nigga out?

http://pastebin.com/2Sq06a0c

Everything is appreciated, just keep in mind I'm new as fuck to programming.

Name: Anonymous 2012-11-14 0:48

var choice = ['rock', 'scissor', 'paper'],
    player = choice.indexOf(prompt('choose rock paper scissor')),
    computer = ~~ (Math.random() * 3);

if (player === -1) throw new Error('fuck you niggar !!');

console.log(
  choice[player] + ' vs ' + choice[computer] + ': You ',
  Math.abs(computer - player) === choice.length -1 ? 'lose' : //roll over
  player === computer ? 'tie' :
    player < computer ?
    'win' :
    'lose'
);
//god language

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List