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
// I learned about the different data types | |
var myName = "this is a string"; | |
var myNumber = 25; | |
var myBoolean = (false, 5>4) | |
//I learned how to output on the console | |
console.log("myName".length); | |
// I learned how to check the length of strings and manipulate the variables in different ways | |
//Modulo |
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
// Check if the user is ready to play! | |
confirm("I am ready to play!"); | |
var age = prompt("What's your age?"); | |
if (age < 13) { | |
console.log("You are able to play but I am not responsible if you are traumatized") | |
} | |
else { | |
console.log("Lets Play!") |
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 userChoice = prompt("Do you choose rock, paper or scissors?"); | |
var computerChoice = Math.random(); | |
if (computerChoice < 0.34) { | |
computerChoice = "rock"; | |
} else if(computerChoice <= 0.67) { | |
computerChoice = "paper"; | |
} else { | |
computerChoice = "scissors"; | |
} console.log("Computer: " + computerChoice); |
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
<DOCTYPE html> | |
<html ng-app> | |
<head lang="en"> | |
<meta charset="UTF-8"> | |
<title></title> | |
<body> | |
<h1>{{hello}}</h1> | |
<input type="text" ng-model="hello" | |
</body> | |
<script type="text/javascript" |
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 text = "Anita, Anita, Anita, Anita, Anita, Anita,Anita,Anita,Anita,"; | |
var myName = "Anita"; | |
var hits = []; | |
for (i=0; i<text.length; i++) { | |
if (text[i] === 'A') { | |
for( j = i; j < (myName.length + i) ; j++){ | |
hits.push(text[j]); | |
} | |
} |