Switch


#1

Hey guys this is my code try it out there is no problem but I made it all by myself and I want to see if you guys like it

var answer = prompt("You wake up and see a giant derp face looking at you through your window. either 'A' run out the front door 'B' keep staring at it 'C' Jump out the window and hug it ");

switch(answer) {
case 'A':
console.log("You run out but it glides towards the door and blocks the door and looks down at you and swallows you whole in one bite DEAD");
break;
// Add your code here!
case 'B':
console.log("You keep staring and you blink so it breaks through the wall and looks straight into your eye and says,'MEEP!' and headbutts you through the wall and you go flying and hit a building. DEAD");
break;
case 'C':
console.log("You jump through the window in slo-mo with glass shards inside your skin you land onto the grass making the glass going deeper into your skin you look up to the derp face. You hug it and it makes a big smile and blushes then hugs you back with the arms it doesnt have THE END");
break;
default:
console.log("You dont decide so it jumps at you breaking the wall it hops toward you and flips your bed over flinging you off the bed into the wall DEAD");
}

`


#2

Happy coding!!!!!!!!


#3

Using break is optional?


#4

Nope using break is not optional it prevents an overflow from a previously executed code.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.