You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this.get('SpeakerModel').say('What if you want to use that string again later on?!')
17
+
this.get('SpeakerModel').say('You can use a \'variable\'. For example, to set \'hatColor\' to \'blue\' you would use the following: var hatColor = "blue";')
18
+
this.get('SpeakerModel').say({
19
+
text: 'Try it out. Set the variable \'moniker\' to "Merlin" in the spell caster below:',
this.get('SpeakerModel').say('It seems we\'ve mostly calmed him down, but what\'s with the exclaimation!?');
17
+
this.get('SpeakerModel').say('In the same way we used \'toLowerCase()\', let\'s use \'replace(searchvalue, newvalue)\' to swap out the \'!\' with a \'.\'.');
18
+
this.get('SpeakerModel').say('Also, let\'s save the returned string into a new var named \'calmReply\'.');
19
+
this.get('SpeakerModel').say('');
20
+
this.get('SpeakerModel').say('');
21
+
this.get('SpeakerModel').say('');
22
+
this.get('SpeakerModel').say('');
23
+
this.get('SpeakerModel').say({
24
+
text: 'You know the drill, to the spell caster:',
25
+
sticky: true
26
+
});
27
+
28
+
//var lessRudeReply = "those dates will cost 190 gold!";
this.get('SpeakerModel').say('These function things are pretty cool, eh? Imagine if we could make our own?!');
17
+
this.get('SpeakerModel').say('Guess what...? We can. Let\'s stick with the date salesman...');
18
+
this.get('SpeakerModel').say('You have a lot of stuff to buy, and you\'re tired of haggling. Let\'s write a function to help, but first, the basics:');
this.get('SpeakerModel').say('The \'result\' above can be many things (number, string, etc.), but here we\'re assuming it\'s a variable that was set during the magic.');
25
+
this.get('SpeakerModel').say({
26
+
text: 'Complete the function below that takes the cost of any goods, and subtracts 5 from it.',
27
+
sticky: true
28
+
});
29
+
30
+
/*
31
+
function haggle(askingPrice)
32
+
{
33
+
var newPrice = ???;
34
+
return newPrice; // we could also return 8, 'hello', but that wouldn't help.
0 commit comments