Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion solutions/01_hello_html/hello.html
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
This is just an example! Hehe.
<!DOCTYPE html>
<html>
<head>
<title> </title>

<script src="hello.js"></script>
</head>
<body>

</body>
</html>
1 change: 1 addition & 0 deletions solutions/01_hello_html/hello.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("Hello, World!")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semicolons aren't required in JS, but I strongly encourage you to make it a habit and always use 'em

9 changes: 9 additions & 0 deletions solutions/04_clickhandler/click.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$(document).ready(function(){

$("div").click(function(){

var output = $(this).html();

console.log(output);
});
});
11 changes: 11 additions & 0 deletions solutions/04_clickhandler/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<script src="click.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to load jQuery before your custom script (click.js) or else click.js will try to run before the jQuery constructor ($) exists

</head>
<body>
<div>Hello</div>
<div>bye</div>
</body>
</html>
11 changes: 11 additions & 0 deletions solutions/09a_length/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title> </title>

<script src="length.js"></script>
</head>
<body>

</body>
</html>
4 changes: 4 additions & 0 deletions solutions/09a_length/length.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

var string= "This is just a string";

console.log(string.length);
14 changes: 14 additions & 0 deletions solutions/Conditionals/grade.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var grade = 50;

if(grade <= 65){
console.log("F");
}
else if(grade <= 74 ){
console.log("C");
}
else if(grade <= 89){
console.log("B");
}
else{
console.log("A");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff!

3 changes: 3 additions & 0 deletions solutions/js_loops/count10.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
for(var i = 1; i < 11; i++){
console.log(i);
}
3 changes: 3 additions & 0 deletions solutions/js_loops/count476.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
for(var i = 1; i < 477; i++){
console.log(i);
}
6 changes: 6 additions & 0 deletions solutions/js_loops/prod15.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var prod = 0;
var j = i;
for(var i = 1; i < 15; i++){
prod *= j;
}
console.log(prod);
5 changes: 5 additions & 0 deletions solutions/js_loops/sum128.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var sum = 0;
for(var i = 1; i < 129; i++){
sum += i;
}
console.log(sum);
5 changes: 5 additions & 0 deletions solutions/js_loops/sum55.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var sum = 0;
for(var i = 1; i < 56; i++){
sum += i;
}
console.log(sum);
22 changes: 22 additions & 0 deletions solutions/roman_numerals/roman.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
var roman = {
M: 1000,
D: 500,
C: 100,
L: 50,
X: 10,
V: 5,
I: 1
};

var num = 526;
var str = ''; //output
for(var letter in roman){
var dummy = Math.floor(num/roman[letter])
if(dummy > 0){
for(var i = 1; i <= dummy; i++){
str += letter;
num -= roman[letter];
};
};
};
console.log(str);