Javascript shitty thing

Posts

Still learning the basic shit but yeah figured out how to make a simple RPS game

Go try it on jsfiddle if you want and/or tell me how I can make it better ;_;
https://jsfiddle.net/

var choice = prompt("Do you choose rock, paper, or scissors?");
var compchoice = Math.random();

if (compchoice < .34) {
   compchoice = "rock";
}
else if (compchoice <= .67) {
   compchoice = "paper";
}
else {
   compchoice = "scissors";
}
document.write("Computer: " + compchoice + "<br>");

if (compchoice === choice) {
   document.write("It's a tie");
}
else if (choice === "rock") {
   if (compchoice === "paper") {
       document.write("You have lost");
   }
   else {
       document.write("You have won");
   }
}
else if (choice === "paper") {
   if (compchoice === "rock") {
       document.write("You have won");
   }
   else {
       document.write("You have lost");
   }
}
else if (choice === "scissors") {
   if (compchoice === "paper") {
       document.write("You have won");
   }
   else {
       document.write("You have lost");
   }
}

For some reason its not working? Idk what I did wrong. I need tech support.

Neebs wrote

For some reason its not working? Idk what I did wrong. I need tech support.

REAL MATURE AMIGO

Or you could have just used the php version on this forum

Aiba wrote

Or you could have just used the php version on this forum

Wat? Have you never heard of practice?

Yoko wrote
Aiba wrote

Or you could have just used the php version on this forum

Wat? Have you never heard of practice?

coulda made something more useful imo

Aiba wrote
Yoko wrote

Wat? Have you never heard of practice?

coulda made something more useful imo

Wut, that wasn't the point though. I am a complete noob at js and that is like all I could make lol
I'm just trying to practice and was just showing off the shitty thing I made
I couldn't make anything useful even if I wanted to ;_;

Yoko wrote
Aiba wrote

coulda made something more useful imo

Wut, that wasn't the point though. I am a complete noob at js and that is like all I could make lol
I'm just trying to practice and was just showing off the shitty thing I made
I couldn't make anything useful even if I wanted to ;_;

You have too practicing im too lazy usually to do programming so im really rusty. Im really good with linux stuff though. Try python its pretty easy to learn. 

Also check this out Magical land of knowledge

Neebs wrote
Yoko wrote

Wut, that wasn't the point though. I am a complete noob at js and that is like all I could make lol
I'm just trying to practice and was just showing off the shitty thing I made
I couldn't make anything useful even if I wanted to ;_;

You have too practicing im too lazy usually to do programming so im really rusty. Im really good with linux stuff though. Try python its pretty easy to learn. 

Also check this out Magical land of knowledge

Javascript is da coolest language tho

And nice link thanks

Yoko wrote
Neebs wrote

You have too practicing im too lazy usually to do programming so im really rusty. Im really good with linux stuff though. Try python its pretty easy to learn. 

Also check this out Magical land of knowledge

Javascript is da coolest language tho

And nice link thanks

I personally am really interested in learning C++ for game development stuff but I just am never motivated enough or have alot of stuff going on.

made a little function to help u find the area of a triangle if you know the sides
ya I'm bad ;_;

// gives you the area of a triangle if you know all 3 sides
var triarea = function(side1,side2,side3) {
        var p = (side1+side2+side3)/2;
        var a = Math.sqrt(p*(p-side1)*(p-side2)*(p-side3));
        return a;
 }
document.write(triarea(5,6,7));

Keep going at it Yoko, the more you practice, the close you get to actually making stuff you wanna make!  :yay:

Eli Ayase wrote

Keep going at it Yoko, the more you practice, the close you get to actually making stuff you wanna make!  :yay:

Thanks, can't wait to be able to make a loli generator ;_;