Skip to content

Commit e1d36a8

Browse files
committed
Assignment-4
1 parent 18bcd6a commit e1d36a8

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

mod4/harder/SpeakGoodBye.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
(function (window){
3+
var byeSpeaker = {};
4+
var speakWord = "Good Bye";
5+
6+
7+
byeSpeaker.speak = function(name){
8+
console.log(speakWord + " " + name);
9+
}
10+
11+
window.byeSpeaker = byeSpeaker;
12+
13+
})(window);

mod4/harder/SpeakHello.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
(function (window){
3+
4+
var helloSpeaker = {};
5+
6+
var speakWord = "Hello";
7+
helloSpeaker.speak = function (name) {
8+
console.log(speakWord + " " + name);
9+
}
10+
11+
window.helloSpeaker = helloSpeaker;
12+
})(window);

mod4/harder/index.html

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Module 4 Solution Starter</title>
6+
<script>
7+
var names = []; // DO NOT REMOVE
8+
</script>
9+
<script src="SpeakHello.js"></script>
10+
<script src="SpeakGoodBye.js"></script>
11+
<script src="script.js"></script>
12+
</head>
13+
<body>
14+
<h1>Module 4 Solution Starter</h1>
15+
</body>
16+
</html>

mod4/harder/script.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
(function (window){
3+
var names = ["Yaakov", "John", "Jen", "Jason", "Paul", "Frank", "Larry", "Paula", "Laura", "Jim"];
4+
for (var name in names) {
5+
6+
var firstletter = names[name].charAt(0).toUpperCase();
7+
if ( firstletter == "J") {
8+
9+
byeSpeaker.speak(names[name]);
10+
} else {
11+
helloSpeaker.speak(names[name]);
12+
}
13+
}
14+
})(window);

0 commit comments

Comments
 (0)