This file contains hidden or 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
| (function() { | |
| // Body | |
| })(); |
This file contains hidden or 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
| // Our deal function will return a random card | |
| var deal = function() { | |
| card = Math.floor(Math.random()*52+1); | |
| return card; | |
| }; | |
| // Deal out our first hand | |
| var card1 = deal(); | |
| var card2 = deal(); |
This file contains hidden or 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 die1 = Math.floor(Math.random()*6 + 1); | |
| var die2 = Math.floor(Math.random()*6 + 1); | |
| var score =(die1===1 || die2===1) ? 0: die1 + die2; | |
| if( die1 === die2 ){ | |
| // if 1 and 1 scores 4 | |
| score = 2*(die1 + die2); | |
| // if 1 and 1 scores 0 | |
| // score = 2*(score); | |
| } |
This file contains hidden or 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
| $('p').css('font-size'); //Manipulates CSS | |
| $('p:first').toggleClass('bigger'); // Adds & removes Class Bigger | |
| $('p:first').hide(); | |
| $('p:first').show(); | |
| $('p:first').toggle(); // toggles between Hide and Show | |
| $('p').text('abcd'); //Strips HTML | |
| $('p').html('<b>abc</b>'); //includes HTML | |
| $('p').prepend('abcd'); //Adds to start of p | |
| $('p').append('abcd'); //Adds to start end p | |
| $('p').before('<h1>abcd<h1>'); //Adds sibling before selection |
This file contains hidden or 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
| // Giving Names to Data | |
| var name ="Paul"; | |
| //JavaScript Types are Dynamic | |
| var alpha = 42; | |
| var bravo = 'Fifty Two'; | |
| var charlie = 5.2; | |
| var delta = true; |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <title>Untitled Document</title> | |
| <meta charset="utf-8"/> | |
| </head> | |
| <body> | |
| </body> | |
| </html> |