forked from lucaswadedavis/seven_ingredients
-
Notifications
You must be signed in to change notification settings - Fork 0
/
si_javascript.js
54 lines (45 loc) · 874 Bytes
/
si_javascript.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//7 ingredients: Javascript
//VARIABLES
var x=10;
var y="words, words, words";
var z=false;
//CONDITIONALS
if (x>10){
console.log(x);
}else{
console.log(y);
}
//FUNCTIONS
var hr=function(n){
var n=n||7;
var d="";
for (var i=0;i<n;i++){
d+="-";
}
console.log(d);
}
hr();
//SETS
var a=['Hamlet','The Merchant of Venice','The Taming of the Shrew'];
var b={"food":"cake","not_food":"not cake"};
console.log(a[0]);
console.log(b['food']);
a.push('The Scottish Play');
console.log(a[3]);
hr();
//LOOPS
for (var i=0;i<a.length;i++){
console.log(a[i]);
}
hr(3);
for (var key in b){
console.log(key);
console.log(b[key]);
}
hr();
//DOCUMENTATION
console.log( "let's be honest: http://www.w3schools.com/js/");
hr();
//EXECUTION
console.log( "browser dev tools console tab, or javascript script tags in html documents.");
hr();