-
Notifications
You must be signed in to change notification settings - Fork 0
/
SpeakGoodBye.js
28 lines (23 loc) · 1000 Bytes
/
SpeakGoodBye.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
// NOTE! The steps in this file are basically identical to the ones you
// performed in the SpeakHello.js file.
// STEP 6: Wrap the entire contents of SpeakGoodBye.js inside of an IIFE
// See Lecture 52, part 2
(function (window){
// STEP 7: Create an object, called 'byeSpeaker' to which you will attach
// the "speak" method and which you will expose to the global context
// See Lecture 52, part 1
// var byeSpeaker =
var byeSpeaker = {};
// DO NOT attach the speakWord variable to the 'byeSpeaker' object.
var speakWord = "Good Bye";
// STEP 8: Rewrite the 'speak' function such that it is attached to the
// byeSpeaker object instead of being a standalone function.
// See Lecture 52, part 2
byeSpeaker.speak = function (name) {
console.log(speakWord + " " + name);
}
// STEP 9: Expose the 'byeSpeaker' object to the global scope. Name it
// 'byeSpeaker' on the global scope as well.
// xxxx.xxxx = byeSpeaker;
window.byeSpeaker = byeSpeaker;
})(window);