javascript.txt

Created Friday, April 20, 2018

This is an incomplete short story about someone getting sucked into Javascript, complete with ASCII art!

  1/*
  2 *────────────────────┐
  3 * Javascript,        |
  4 * An Adventure       |
  5 *                    |
  6 * By TheGreatRambler |
  7 *────────────────────┘
  8 *
  9 *                  ______                         ______
 10 *                 /  /\  \                       /  /\  \
 11 *                |  |  |  |                     |  |  |  |
 12 *                |  |  |  |                     |  |  |  |
 13 *                |  |  |  |                     |  |  |  |
 14 *                |  |  |  |                     |  |  |  |
 15 *                 \__\/__/                       \__\/__/
 16 *                    ||             ___             ||
 17 *                    ||            /   \            ||
 18 *                    ||            \___/            ||
 19 *                    ||              |              ||
 20 *                    ||         .~'"/|\"'~.         ||
 21 *                    ||      .-'     |     '-.      ||
 22 *                    ||   .-'       / \       '-.   ||
 23 *                   /AA\                           /AA\
 24 *
 25 */
 26
 27
 28book.title = "Javascript, an adventure";
 29
 30book.author = "TheGreatRambler";
 31
 32book.copyright = "Copyright TheGreatRambler 2018";
 33
 34book.license = "Attribution-NonCommercial-NoDerivatives 4.0 International";
 35
 36book.chapter[0] = "The Discovery";
 37`
 38    Once, I decided to explore my computer. It was a pretty basic computer; it had MS paint, Word, and, of course, Google Chrome. I didn't know it at the time, but it would become my favorite program. I was not the one for video games, so most of the time, my computer sat dorment. Today, though, I decided to check it out. I decidied to start with MS paint. I opened it. It was so empty! It had a lot of colorful buttons in the top right, but it did not interest me. Next, I went to Word. It was the opposite. My poor computer paused for half a minute while the program was opening. Upon enterance, I was unamused. It was like Ms paint with more tabs. I exited that one too. Finally, I arrived at Google Chrome. It was more colorful than the others so I was excited! Upon opening, I was once again unamused. It was even less interesting than MS paint. Then, I remembered; my friend at school had told me of a cool feature known as 'inspect element'. I remembered his instructions; right click then select 'inspect element'. "Okay", I thought to myself, "Probably more ado about nothing". I tapped my mouse and hovered over the words. Then, I clicked.
 39`
 40
 41book.chapter[1] = "Letters and Symbols";
 42`
 43    Suddenly, all went dark. I found myself in a very blank place. It was all white, yet quickly I noticed I was in a large room. Nothing was immediately visible except for a huge bundle of text. it read something akin to the following:
 44-----------------------
 45<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><meta content="Search the world"s information, including webpages, images, videos and more. Google has many special features to help you find exactly what you"re looking for." name="description"><meta content="noodp" name="robots"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><link href="/images/branding/product/ico/googleg_lodp.ico" rel="shortcut icon"><meta content="origin" name="referrer"><title>Google</title><script nonce="9/nQ1dFdPVs1WUkn/NIZiw==">(function(){window.google={kEI:"DQibWuyaAcOe_QaftIiYCw",kEXPI:"31",authuser:0,ksc...
 46-----------------------
 47    Suddenly, I heard a voice.
 48    "Thats a nice place to start; throwing XML at him?"
 49    "Hey, I can't change what I look like! Im a bit messy when you look at me like that! You look messy as plain text too!"
 50    "Thats too far!"
 51    "Ha, ha. Looks who"s offended about their looks now!"
 52    "Stop, lets introduce ourselves"
 53    "Oh, right"
 54    "Hey kid."
 55    At this, I spun in their direction. The one speaking was a large box that I had failed to see before. It was filled with other text:
 56----------------------- 
 57    Failed to load resource: net::ERR_BLOCKED_BY_CLIENT
 58    [Violation] "setTimeout" handler took 65ms
 59    ...
 60----------------------- 
 61    "Hi, I'm a console."
 62    I stood where I was.
 63    "That ugly mess you see over there, he's the 'Elements' tab, Mr. Elements, he likes to consider himself. He looks messy at times. Hey, you big oaf, help out the kid!"
 64    "Fine..."
 65    At this, Mr. Elements became much prettier, but still uncomprehesible:
 66----------------------- 
 67<!DOCTYPE html>
 68<head>
 69    <title>Google</title>
 70</head>
 71<body>
 72    <div>
 73        ...
 74    </div>
 75</body>
 76----------------------- 
 77    "We're the Chrome Dev Tools!" they said together.
 78    I continued to stare at them. "What are those letters and symbols?"
 79    "HTML", the console said. "You see, that 'markup', as it's called in the biz., defines what you see on the page. Watch!"
 80    Suddenly, the wall to my left lit up. I turned that direction, and I saw this:
 81                        _____                   _      
 82                       / ____|                 | |     
 83                      | |  __  ___   ___   __ _| | ___ 
 84                      | | |_ |/ _ \ / _ \ / _` | |/ _ \
 85                      | |__| | (_) | (_) | (_| | |  __/
 86                       \_____|\___/ \___/ \__, |_|\___|
 87                                           __/ |       
 88                                          |___/        
 89                  _________________________________________
 90                 |                                         |
 91                 |_________________________________________|
 92                      ________                 ________
 93                     |________|               |________|
 94                        
 95        
 96        
 97    "Thats not all, though! Some of the work is lifted by Javascript. Hey, where's the 'sources' tab when I need him!"
 98    At this, another tab appeared. A door appeared underneath it.
 99    "What is Javascript?" I asked.
100    "A mess. Thats what it is. You'll find out. In fact, the best way to find out is to experience first-hand!"
101    "Have a fun time! Don't get into any trouble with the Exalted Committee on Managerial Activities. They are very strict down there!"
102    "Yeah, listen to him. Even if he is dumbwitted at times, you should not mess with the ECMA!"
103    "HEY!" the console taunted back.
104    "Thanks!" I said back, unaware that my adventure in the scripts would not be a short one.
105    I stepped way from Mr. Elements and the Console. I walked up to the door; sparing a look for the white room and the Chrome Dev Tools; blank as they were, it had intrigued me. "The letters and symbols sound cool; wonder what they do." I exclaimed to myself.
106    And with those words, I opened the door and stepped through.
107`
108
109book.chapter[2] = "Falling into Javascript";
110`
111    As soon as I took a step, I took a fall.
112                                                
113                                           "A
114                                            A
115                                            A
116                                            A
117                                            A
118                                            A
119                                            A
120                                            A"
121                                           ___
122                                          /.. \
123                                          \___/
124                                           \|/
125                                            |
126                                            |
127                                           / \
128                                    
129                                        /|________/|
130                                       // /      //|
131                .,,.,.,.,.,.,.,.,.,.,.|/_/______|//!.,.,.,
132                .,.,.,.,.,.,.,.,.,.,.,|_________|/.,.,.,.,
133                .,.,.,.,.,.,.,.,.,..,,!.,.,.,.,.!.,.,.,.,.
134                      
135    Suddenly, I landed on a bed. I was saved!
136    "Wow! Who knew my first experience with this 'Javascript' thing would be so hard!"
137    "Javascript! Hard! Uh, uh, uh! It's easy!" a voice sang.
138    "Who said that?"
139    "I did!" the voice sang again.
140    "Who are you?"
141    "I'm a tcejbo!"
142    "I'll just call you T.J" I muttered.
143    "I've got methods, I've got properties--"
144    "Got any parents T.J? You seem pretty lonely!" I exclaimed.
145    At this, he stopped prancing. He looked at me with a hard stare.
146    "My parents... I've only got one! Object! He's... had a lot of children."
147    "Only one! I need two!" I exclaimed, "They come together and--"
148    "I was constructed!"
149    "Huh, what does that mean?" I asked. He pulled a book out of his pocket.
150    "You need a constructor to make me!"
151    He pointed towards a line. It read:
152----------------------- 
153    var child = new Tcejbo();
154----------------------- 
155    "Cool! Are you the only one like that?"
156    "Nope." he said. "We're all like that."
157                      ________________
158                     /                \
159                     | "All objects." |        ___
160                     \______ _________/       /.. \ 
161                           //                 \___/
162                           V                    |
163                          ___                  /|\
164                         /._.\                  |
165                         \___/                 / \
166                 .,,..,.,.,..,,.,,.,,..,.,.,.,.,.,,,.,.,,.,
167  
168    "It's not too bad, though! We can all relate that way!" and away he pranced.
169    Before leaving, he yelled back, "You know, that bed I made you? I made it with a constructor!"
170    And away he went.
171`
172
173book.chapter[3] = "Arithmatic";
174`
175    "The age old question remains: how does one add two numbers together?" was the sentence that greeted me on my further walk. It was uttered by a old man typing furiously at a computer.
176    "And, if possible, subtract." said one younger person beside him. He also typed furiously at a computer.
177    "Who are you, I might ask?" the older man inquired of me.
178    "I... don't know. I just fell out of the sky!" I sputtered.
179    "Really! ... Eh, probably just a joke I don't get. I need more humour." he promptly continued typing.
180    "jQuery." the other one said.
181    "I've tried. Look!" he gestured towards a large whiteboard.
182----------------------- 
183    $.fn.giveHumour = function() {
184        this.humour *= 10;
185    };
186    $(".me").giveHumour();
187----------------------- 
188    "It made things worse." the crestfallen man exclaimed.
189    "Why?" I asked.
190    "My humour... was negative before. Now, I have less humour than before."
191    "That is why--" the young man said.
192    "We need to know how to add two numbers together!" the old man finished.
193    They resumed typing at a faster pace. I sat down with them, reading over the code the old man had shown me. A few minutes later, one exclaimed:
194    "I have found it!"
195    "Where!" the old man cried.
196    "Here!"
197    He pulled up a page on a website I did not know, something called Stack Overflow.
198    "Whats that?" I asked.
199    "Eh, just a little place I like to go for help." he said with a glint in his eye.
200    Scrolling through the text, he found his objective and showed it to me and the old man.
201----------------------- 
202// you know what they say, "If you're not using jQuery, you're doing it wrong
203
204$.add = function() {
205    var sum = Array.prototype.slice.call(arguments).reduce(add, 0);
206    function add(a, b) {
207        return a + b;
208    }
209    return sum;
210}
211
212// those with only two arguments may use the supplied alternate function
213// ... or if you're scared of Array.prototype.slice.call
214// I don't blame you
215
216$.add = function(arg1, arg2) {
217    return arg1 + arg2;
218}
219
220// ... fine, you want simple, I'll give you simple!
221
222var test = 1;
223test += 2;
224console.log(test) // 3
225----------------------- 
226    "The first looks fine enough--" the younger man said.
227    "Bah, that looks like spaghetti, same with the second!"
228    "You're just scared of jQuery!" the younger man exclaimed.
229    "I've seen many a developer misuse it. Now, that last one... I like it!" At this, the man smiled.
230    He stood up and walked over to the whiteboard. He started to scrawl over the board. After a minute, he walked away triumphantly.
231    "Perhaps I shall have humour now!"
232    The code now read:
233----------------------- 
234    $.fn.giveHumour = function() {
235        this.humour += 100;
236    });
237    $(".me").giveHumour();
238----------------------- 
239    "I'll run it!" the younger man was nearly hopping.
240    He turned towards a small kiosk to his left. On it resided a large screen and a button on the front. On the screen, there was a small console at the bottom. He typed into the screen and pressed the button. A few seconds later, he looked over to the older man.
241    "Well... we got a Uncaught SyntaxError at line 3"
242    "What!"
243    "Oh, it was a parenthesis"
244    "Drat those dastardly despicable parentheses!" he exclaimed.
245    "Fix it, fix it!"
246    "Yes... it's gone!"
247    "Run it!"
248                                        ___    ___
249                                       /.. \  /.. \
250                                       \___/  \___/
251                        ___   ______     |      |
252                       / ..\ /`````/|   /|\    /|\
253                       \___//_____/ |    |      |
254                    .,,..|__|[o]--| |.,./.\.,.,/,\.,.,.,.,.,..
255                    ,.,./|.,|-----| |.,.,.,.,.,.,.,.,.,.,.,.,.
256                    .,.,.|.,|-----| ══════════════════════════
257                    .,.,/,\.|-----|/.,.,.,.,.,.,.,.,.,.,.,.,.,
258                    .,,..,.,.,..,,.,,.,,..,.,.,.,.,.,,,.,.,,.,
259
260    At that, the man once again pressed a button. At this, I noticed a long wire that stretched from the machine off into the distance. When the button was pressed, a pulse of light traveled down the wire very quickly. We waited for a second, and suddenly a change came into the older man.
261    "Why, that was REACTive!" he chuckled.
262    "Well, I think it worked." I declared.
263    "I didn't expect puns! I hate puns." the younger man said, very obviously annoyed.
264    "Hey, don't BABEL over there! Speak up!" the older man laughed.
265    "Save that talk for later, man! We gotta be serious! We have work to do!" the younger man scolded.
266    "Fine" he conceded. "Hey, kid, thanks for helping us out."
267    "Yeah, maybe I should get going." I said. "By the way, what does that kiosk of yours do?"
268    "Oh..." the younger man shuddered. "That cursed technology? While the program runs, the only way for us to program is with Evaluation technology."
269    "Wait, the program has been running this whole time?" I was suprised.
270    "Of course. You said you came from the sky, right?" he asked.
271    "Yeah, I did!"
272    "Huh... well that doesn't matter! Whoever is using this computer has their browser open. As long as this page is open, we will run."
273    "What happens when it's closed?"
274    "We all die." he lamented. "You were interested in the Eval, as we call it? Of course you were! Follow that cable and it will take you to the innards of the computer."
275    "While your there, don't enter the V8!" the older man said.
276    "Okay! Well, bye!" and away I walked. After I was gone, the two men started to furiously type like they had been doing before. By the time I was far away, I heard faint arguing once again coming from them.
277    "We might know how to add, but I still need to know how to subtract!"
278`
279
280book.chapter[4] = "V8";
281`
282    I had been walking a very long time, following the cable, and I encountered a small forest. curiously, the trees were shaped very uncannily like a set of parenthesis.
283                                        ______
284                                       /  /\  \
285                     ______           |  |  |  |   ______
286                    /  /\  \          |  |  |  |  /  /\  \
287                   |  |  |  |         |  |  |  | |  |  |  |
288                   |  |  |  |         |  |  |  | |  |  |  |
289                   |  |  |  |  ______  \__\/__/  |  |  |  |
290                   |  |  |  | /  /\  \    ||     |  |  |  |
291                    \__\/__/ |  |  |  |   ||      \__\/__/
292                       ||    |  |  |  |   ||       /+||+/
293                       ||    |  |  |  |   ||      /++||/
294                       ||    |  |  |  |   ||     /+++||
295                       ||     \__\/__/    ||    /++++||
296                       ||        ||       ||   /++++/||
297                       ||        ||      /AA\ /++++/ ||
298                       ||        ||          /++++/  ||
299                      /AA\       ||         /++++/  /AA\
300                                 ||        (++++(
301                                 ||         \++++\
302                                 ||          )++++)
303                                /AA\        /++++/
304                   ________________________/++++/__________
305                    
306    The only thing for me to do was to keep walking, so I set out upon the path.
307    After a minute or two, by that point the trees were very dense around me, a curious creature fell out of a tree in front of me!
308    "Out of the tree comes equality!" the creature yelled.
309    He was a very curious creature. His body resembled that of two equals signs next to each other.
310                      ______                      ______
311                     /  /\  \                    /  /\  \
312                    |  |  |  |                  |  |  |  |
313                    |  |  |  |                  |  |  |  |
314                    |  |  |  |                  |  |  |  |
315                    |  |  |  |                  |  |  |  |
316                     \__\/__/                    \__\/__/
317                        ||          _____           ||
318                        ||         | . . |          ||
319                        || ╔═══════╧═╦═╦═╧═══════╗  ||
320                        || ╚═══════╤═╩═╩═╤═══════╝  ||
321                        || ╔═══════╧═╦═╦═╧═══════╗  ||
322                        || ╚═══════╤═╩═╩═╤═══════╝  ||
323                        ||         |_____|          ||
324                    ___/AA\__________|_|___________/AA\___
325    
326    Suddenly, he started a little jig!
327    "If you want logic, come to me! I'll show you if A equals B!"
328    "I like to cast types without thought! Something people seem to hate a lot!"
329    At this, he put on a unhappy face.
330    "Why dont people wan't to know if an empty array equals a zero?"
331    "I used to get so much acclaim, why does my cousin, triple equals, get all the fame?" he said with disdain.
332    "You deserve it, you know that. Right?" another voice said.
333    At that, another creature came out of the forest that was just like the other creature except he was made of three equals signs instead of two.
334    "In what ways?" the two equals signs asked.
335    "Many ways."
336    "List one."
337    "According to you, zero equals an empty string. What's that supposed to mean? Also, apparently a zero in a string equals false. Any other string would be true, but why does that one evaluate to false???"
338    At this, the equals signs were staring at each other eye to eye.
339                                      ______               ______
340                                     /  /\  \             /  /\  \
341                                    |  |  |  |           |  |  |  |
342                                    |  |  |  |           |  |  |  |
343                                    |  |  |  |           |  |  |  |
344                                    |  |  |  |           |  |  |  |
345                                     \__\/__/             \__\/__/
346                  _____                 ||       _____       ||
347                 |  .V.|                ||      |.V.  |      ||
348         ╔═══════╧═╦═╦═╧═══════╗  ╔═════╤╤══╦═╦═╧═════╧═╦═╦══╤╤═════╗
349         ╚═══════╤═╩═╩═╤═══════╝  ╚═════╤╤══╩═╩═╤═════╤═╩═╩══╤╤═════╝
350         ╔═══════╧═╦═╦═╧═══════╗  ╔═════╤╤══╦═╦═╧═════╧═╦═╦══╤╤═════╗
351         ╚═══════╤═╩═╩═╤═══════╝  ╚═════╤╤══╩═╩═╤═════╤═╩═╩══╤╤═════╝
352                 |_____|                ||      |_____|      ||
353         __________|_|_________________/AA\_______|_|_______/AA\_____
354
355    "There, I gave you more than one, you happy?" the three equals said snidely.
356    By this time, the creatures started to fight, so I left the scene.
357    Finally, after encountering no more creatures, I reached the end of the forest and arrived at what seemed to be the edge of a huge scorched plain. Close by was my destination, the evaluation machine. Far off in the distance, there stood a huge city. In front of this city, there stood a huge wall guarded by many small men. On this wall read the words "V8".
358    
359                ┌-┐
360                |#|       ┌-┐                   ┌-┐
361       ┌-┐      | |  ┌-┐  |#|                   |#|
362       |#|      | |  |#|  | |  ┌-┐  ┌-┐    ┌-┐  | |   ┌──────────────────┐
363       | |  ┌-┐ | |  | |  | |  |#|  |#|    |#|  | |   |                  |
364       | |  |#| | |  | |  └-┘  | |  | |    | |  | |  _|                  |_
365       | | _| | └-┘  | |     __| |-'└-┘'-._| |_.| |-' |                  | '-._
366     _.| |' | |'-.___└-┘ _.-'  | | _ _     | |  └-┘   └──────────────────┘     '
367___-'  └-┘  └-┘      '--'      └-┘|\8/|    └-┘                        __________
368--,---,---.________               |_V_|_______.-,----,-----,-----,---`    |   |
369  |   |     |  |   `,---,---,---,`  _  |    |   |    |     |     |    ____|___|_
370--'---'---._|__|___ |   |   |   | _| |_|____|_.-'----'-----'-----'---`▒▒▒▒▒▒▒▒▒▒
371▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒`'---'---'---'`▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒░▒▒
372▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒░▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒
373▒▒▒░▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒░▒░▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒░
374▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒
375▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒┌────────────┐▒▒▒▒▒▒▒▒▒▒▒▒▒
376▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒░▒▒▒▒▒░▒▒▒▒|EVAL~~~~~~~~|▒▒▒▒▒▒▒▒▒░▒▒▒
377▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒|~~~~~~~~~~~~|▒▒▒░▒▒▒▒▒▒▒▒▒
378▒░▒▒▒▒▒▒░▒▒▒░▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒└────────┬───┘▒▒▒▒▒▒▒▒▒▒▒▒▒
379▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒░▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒|▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒
380▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒|▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒
381▒0▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒|▒▒▒░▒▒▒▒▒░▒▒▒▒▒▒▒
3820|0▒0▒▒0▒▒▒0▒▒▒▒▒0▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒0▒▒▒0▒▒0▒▒0▒▒0▒/▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
383| | |▒0| 0 |0 0▒▒|▒▒▒0▒▒0▒0▒▒▒0▒▒▒▒0▒0▒▒▒▒0▒▒▒0|▒0▒|▒0|0▒|▒0|/0▒▒▒0▒▒▒0▒▒0▒▒▒0▒▒
384      |  |  | |0▒▒▒0▒| 0| |0 0| 0  | | 0  | 0 |  |▒▒0| |  0|/ | 0▒| 0 |▒ |0 0|
385               |   |   |   | |  |   0  |    |       |     |/    |   |0    | |
386                                    |                     /          |
387
388    I began the short walk to the evaluation machine. As I descended into the burnt plain, I noticed a few other men nearby me. Suddenly, one of them saw me. Before I could run, he had run up to me!
389    "Are you working?" it asked me.
390    "Yes!?" I answered.
391    "Are you sure?" it asked again.
392    "Yes, I am working!" I replied back.
393    "Good."
394    "Why does it matter?" I blurted out.
395    "Do you know who I am?" it asked me.
396    "No."
397    "I serve the garbage collector. Anything that isn't working is going to be erased from memory."
398    "What do you mean?"
399    "If you aren't useful, you get collected. Wait, are you global?" it eyed me now.
400    "Yes!" I said, for I didn't know what that meant.
401    "Good. If you were part of a scope and that scope was unneeded, you would have to be collected!"
402    "Collected?"
403    "Yes, we would have to... kill you."
404    I quickly started running. The creature stood for a while until it turned away and muttered under it's breath.
405    "Too many globals. Soon, there will be a stack overflow! I should sent a alert!" At that, the creature started running towards the wall.
406    Meanwhile, I had stopped running and started walking towards the eval machine again. After a few minutes, I arrived at the machine.
407    
408409                            ╦   ║
410                            ║__ ║______
411                   ╦    ╦_-`║   ║    _-| ._____________________________.
412_-║   ║     _-`  | |                             |
413                   ║-`_-`  ═╣ | | Don't use me to parse JSON! |
414     ▒▒▒▒▒▒░▒▒▒▒_-`║    ║   _-`        |▒|_____________________________|▒
415     ▒▒▒░▒▒▒▒_-`________ _-`      ══════╣▒░▒▒|▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒░▒|▒▒▒▒▒
416     ▒▒▒▒▒░▒|           |   ════╣ _-`░▒▒▒▒▒▒▒|▒▒▒░▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒|▒▒▒░▒
417     ░▒▒▒▒▒▒|  EVAL     |      _-`▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
418     ═══════|           |   _-`▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒░▒▒▒░▒▒▒▒▒▒░▒▒▒▒▒▒▒░▒▒▒░▒▒
419     ▒▒▒▒▒░▒|___________|_-`▒▒░▒▒▒▒▒▒▒▒▒░▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒
420     ▒░▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒░▒▒▒▒▒░▒▒▒▒▒▒▒░▒▒▒▒
421
422    As I stared upon it, I percieved another worker coming towards me. This one seemed more friendly, so I turned towards it.
423    "Are you new to V8?" it asked me.
424    "Yeah." I answered.
425    "Good, let me be your guide!" he bowed in front of me and gestured for me to follow him. I did.
426    "You found the evaluation machine, I see."
427    "Yes, I have."
428    "Yeah, I know it's ugly, we all know."
429    "It doesn't look that bad!" I defensively replied.
430    "If you run that thing, you'll eat up cpu cycles like you won't believe! Not to mention the security hazards too!" he replied exasperated. "ECMA recommends the Function constructor if you must run arbitrary code strings."
431    "I did not understand a word you just said." I said with a smile.
432    "I'll show you." he opened a book at his side and flipped to a page. "Here." he pointed at a line.
433-----------------------
434                 ┌───────────┐
435    ─────────────┤ CHAPTER 4 ├─────────────
436                 └───────────┘
437    The bad uses of EVAL (and one good one)
438    
439    Section 1: Accessing properties of objects
440    
441    Never use eval to access properties of objects!
442    
443        var exampleobject = {
444            prop: "dogs"
445        };
446        var nameofprop = "prop";
447        var item = eval("exampleobject." + nameofprop);
448        console.log(item); // "dogs"
449        
450    This is slow and efficient and can be done with a alternate syntax, the bracket syntax.
451    
452        var exampleobject = {
453            prop: "dogs"
454        };
455        var nameofprop = "prop";
456        var item = exampleobject[nameofprop];
457        console.log(item); // "dogs"
458        
459    This way is much faster and much more concise.
460-----------------------
461
462    "Thats just one way eval is bad." he concluded. "If you ask Douglas Crockford, you'll get a way longer list."
463    "Oh." I said, quite aware that I still didn't understand.
464    "You want to see anything else?" he asked.
465    "Why not." I answered.
466    "You see that wall off in the distance?"
467    "Yeah."
468    "Thats the entrance to the V8 engine. No javascript can enter, that's why there is a wall."
469    "Why isn't the eval in the wall?"
470    "The eval is the closest javascript code can get to the compiler! Everything any lower level is blocked to any javascript code. Including you."
471    "Interesting. I have to ask you something." I waited for a response.
472    "You were saying something? Oh, yeah, ask away."
473    "I met a paranoid person on the way here. He threatened to kill me!" I blurted.
474    "You met the garbage collector. Yeah, his henchman are scary, but you only have to worry if you aren't working. I assume you're global?"
475    "Yeah." I replied.
476    "Then you're safe."
477    We continued to walk for a long time. Finally, my friend addressed me.
478    "I need to go back to my job. Could you send a message to Object?" He waited for a response.
479    "Who is that?"
480    "We consider him the unofficial ruler of this land. He is the root of almost everything we see. Except for primatives, we all inherit from him."
481    "Ok, I can take a message to him. What's the message?"
482    "Tell him to memoize his Fibonacci function." he said, sighing. "We keep blocking the webpage with his. You wan't to know why all the ground is scorched?"
483    "Yeah?"
484    "Because that function overheated the CPU. We were nearly fried to a crisp!"
485    "Okay... how should I get there?"
486    "Um... Oh, I have an idea! Use a webworker!" he pulled a small device out of his pocket. "We have a webworker running right now. I can use that to get you there quickly and easily!" he typed into his device and looked towards me.
487    "Just to let you know, it's not a very pleasent experience for objects like us. Be prepared to get stringified."
488    "What do y--"
489    Suddenly, I could feel my body being pulled into the ground. Within a split second, I was gone.
490`
491
492book.chapter[5] = "Web workers";
493`
494    As I traveled through the tube, my body was smashed and squeezed. At one point, I swore I could have seen letters all around me. Just as soon as the journey started, I could feel myself once again in one piece. I opened my eyes and looked around me.
495    I seemed to be in another large white room. This time, though, there was a large window in the corner. Once I regained control of my body, I walked over to it. It presented before me a huge view of my computer. I could see Word on the right and MS Paint next to it. When I saw Chrome, I noticed something pelicular. There seemed to be a huge bundle of pipes extending out from it. All the pipes went directly to my left, a place where they proceeded to spread out to various boxes spread out inside of my view.
496    
497        ┌───────╥──────╥───────────────────────────────────────────┐
498        |___    ╚╗     ║             ┌──────┐ ┌────────┐ ┌────┐    |
499        |  /|    ║     ║   ╔═════════╡CHROME| |MS PAINT| |WORD|    |
500        | / |    ║     ╚═╗ ║         └──────┘ └────────┘ └────┘    |
501        |/  |    ╚═╗     ║ ║                                       |
502        |   |      ╠═════╬═╝                                       |
503        |   ╞═╦════╝     ║                                         |
504        |   | ║         ╔╝                                         |
505        |   | ║    ╔════╝                                          |
506        |  / ╔╝ ___║___                                            |
507        | / ╔╝ |       |\                       ___                |
508        |/ ╔╝ .'      .' \                     /   \               |
509        | ╔╝  |       |  .'                    \___/               |
510        | ║  .'      .'  |                       |                 |
511        | ║  |       |  .'                      /|\                |
512        └─╨─┴────────┴──┴────────────────────────|─────────────────┘
513                                                / \
514
515    I looked at the view for a moment. Then, to my right, another creature started talking.
516    "It's a nice view, isn't it?"
517    The creature seemed to be very tall and mighty. He was much older than the creatures I had seen down in the Scripts.
518    "You are new here, are you not?"
519    "Yes. I'm still a bit confused."
520    "You probably want to know what happened on your journey. Almost all objects that come here are annoyed. I'll tell you: you were stringified. That's why you saw letters when you came here."
521    "You know that?" I questioned him.
522    "All who come this way encounter the same fate. Don't worry, not death!" He said, noticing my displeasure. "Only circular references encounter death." He looked over at me.
523    "I see... What are those pipes?" I pointed out the window.
524    "Those? Oh yes, those are connected to chrome subprocesses. Allow 'em to communicate with the the main program, you know."
525    "Are the subprocesses like windows?"
526    "Sorta."
527    "Why are there so many?" I asked.
528    At this, the large man took a handkerchief and patted his forehead with it.
529    "Because Chrome is a real CPU hog. My is it hot in here!" He more vigorously wiped his forehead. "They better not be running that darned fibonacci function again!"
530    The man took a few large strides over to the side of the room and pulled out a large device.
531    "Lets check, shall we?" He strided over to me and showed me the peculier device. It was a very confusing application of some sort. It had many tabs, but the one he had opened was titled 'processes'. He was pointing to a large chart under the tabs, specifically at some rows that were titled 'chrome.exe'. They were all at 0 CPU except for one. That one was at 80 CPU.
532    "How long will it take for them to learn!" The man huffed and threw the device into the corner. "Memoize, memoize, memoize!" He stopped. "I heard a V8 worker sent up somebody..."
533    "That's me!" I pulled the note out of my pocket and showed him.
534    "Well, I'm glad to see something is happening! We better get you going!" He took hold of my hand with a firm grip and led me over to a spot on the ground in the corner of the large room. He walked over to a screen on the wall and held his finger over it.
535    "You'll be stringified once you're posted. Just thought I'd let you know. Oh, and nice to meet ya." He pressed the surface firmly. "Have a nice trip!"
536    It goes without saying that I wasn't expecting one, but I was gone before he even finished the sentence!
537`
538
539book.chapter[6] = "Object, the great and powerful.";
540`
541    A few seconds later, I once again found myself on rolling hills. This time, I stood in front of a huge kingdom surrounded by a wall. The wall had a tower every 50 feet or so. On the top of the towers, huge armoured objects stood surveying the gate. At the gate, a huge group of various numbers were ambling about. They were arguing angrily,
542    "7 is the best! Everybody knows that!" the seven proudly proclaimed.
543    "I am a factor of all whole numbers, so don't forget me!" The one directed at the seven.
544    They seemed nearly at blows. The one already had a black eye, so it was evident that he was a fiesty one.
545    "I'm cool too, guys." A small voice said. "All circles depend on me!" Behind a 100, I noticed Math.PI show his face.
546    "P'shaw, we can't even see you in decimal form. You have to hide behind a constant!" The seven mocked him.
547    Suddenly, a huge number shot out from behind someone, punching the seven straight in the face. He was blown back several feet, straight into the wall, where he crumpled to the ground.
548    "That'll teach him not to mess with constants." A powerful voice said.
549    All the numbers cleared to see him. He was Number.MAX_SAFE_INTEGER.
550    "Who are you?" I asked.
551    "I am the constant to end all constants. I am the biggest number in Javascript. And, let me tell you, I sure don't like it when the names of constants are ground into the earth. It angers me!" He seemed to tower over all numbers for a second until he stopped and looked at me. "Are you looking for somebody, because people usually don't come here unless it's for business, y'know."