<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6471655507948515267</id><updated>2011-10-10T22:52:07.473-07:00</updated><title type='text'>SwissRunner</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://swissrunner.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6471655507948515267/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://swissrunner.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>SwissRunner</name><uri>http://www.blogger.com/profile/14567045470172240780</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6471655507948515267.post-2018279749088202826</id><published>2011-02-13T15:38:00.000-08:00</published><updated>2011-02-13T15:38:13.606-08:00</updated><title type='text'>Assignment - Week3</title><content type='html'>&lt;ol&gt;&lt;li&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;b&gt;In Javascript, functions are  first class objects. What does it mean to be a first class object?&lt;/b&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;span style="font-weight: normal;"&gt;This  means that javascript functions are special type of object that can  do all the things that regular objects can do This s&lt;/span&gt;supports  constructing new functions during the execution of a program,  storing them in data structures, passing them as arguments to other  functions, and returning them as the values of other functions.&amp;nbsp;&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;b&gt;Functions and variables share  the same namespace. What does this mean and what important  implication does this have? &lt;/b&gt;  &lt;/div&gt;&lt;div style="font-weight: normal; margin-bottom: 0in;"&gt;By definition, a  namepace is an abstract container to hold a logical grouping of  unique identifiers or symbols which are unique to a specific  namespace but have no correlation within another namespace.  Moreover, in javascript, functions can be defined just like  variables, meaning, a variable can reference a simple numeric value  but also reference a complete function. So, if we declare a global  variable var x and function local variable var x the, when we  execute the program and the function is executed, the function local  variable x with shadow the global variable x. This can lead to  incorrect evaluations where the variable x is involved.&amp;nbsp;&lt;/div&gt;&lt;div style="font-weight: normal; margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: normal; margin-bottom: 0in;"&gt;       &lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;b&gt;Douglas Crockford equates  Javascript functions with Lambdas, and also mentions that they are a  secure construct. Can you do some research and reflect on what he  means by 'secure construct'? &lt;/b&gt;  &lt;/div&gt;&lt;div style="font-weight: normal; margin-bottom: 0in;"&gt;Haven't found any  good explanation to answer this question sufficiently.&lt;/div&gt;&lt;div style="font-weight: normal; margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;b&gt;Can you explain the concept of  a closure. &lt;/b&gt;  &lt;/div&gt;&lt;div style="font-weight: normal; margin-bottom: 0in;"&gt;In JavaScript a  closure is the local variable of a function kept alive after the  function has returned. This form of “closure” occurs when  creating a function within another function where the local function  variables are still accessible after the inner function has  returned.&lt;/div&gt;&lt;div style="font-weight: normal; margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;b&gt;What is the difference between  a function and a method? &lt;/b&gt;  &lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;span style="font-weight: normal;"&gt;In  JavaScript a function is a piece of code that is called by a  specific name.  The function accepts and passes data, parameters, to  operate on and uses a return statement to return a value to the  caller.&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;span style="font-weight: normal;"&gt;A  method, on the other hand, has also a specific name but its name is  associated with an object.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;span style="font-weight: normal;"&gt;&amp;nbsp;&lt;/span&gt;  &lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;b&gt;In Javascript there is no  implicit type checking of arguments passed to functions. This could  lead to bugs if programmers are not careful about what they pass to  functions. If you create a function, how would you protect it from  well meaning but careless programmers? &lt;/b&gt;  &lt;/div&gt;&lt;div style="font-weight: normal; margin-bottom: 0in;"&gt;One way is to  check the number of arguments passed to the function. The parameter  list is stored in an object/array “argument” and so its length  can be called.&lt;/div&gt;&lt;div style="font-weight: normal; margin-bottom: 0in;"&gt;Also, the  programmer can pass an object, containing the name/value pairs of  the function, as a parameter to the function.&lt;/div&gt;&lt;div style="font-weight: normal; margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;b&gt;Javascript functions have  implicit access to something called &lt;i&gt;this&lt;/i&gt;. &lt;i&gt;this&lt;/i&gt; points  to different things depending on how the function was created. Can  you explain why we need &lt;i&gt;this&lt;/i&gt;, and what it represents in  different type of functions. &lt;/b&gt;  &lt;/div&gt;&lt;div style="font-weight: normal; margin-bottom: 0in;"&gt;The “this”  refers to the owner of the function we're re executing, meaning,  “this” refers to the object that the function is a method of.&lt;/div&gt;&lt;div style="font-weight: normal; margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;b&gt;Why doesn't Javascript have a  cast operator? &lt;/b&gt;  &lt;/div&gt;&lt;div style="font-weight: normal; margin-bottom: 0in;"&gt;Unlike in many  other programming languagetype to be defined, in javascript no type  declaration is required   &lt;/div&gt;&lt;div style="font-weight: normal; margin-bottom: 0in;"&gt;var value=10, var  hello=”Hello”, var set = function() {statement}&lt;/div&gt;&lt;div style="font-weight: normal; margin-bottom: 0in;"&gt;None of the above  declarations require a type.  Yet JavaScript knows how to evaluate  each declared variable.&amp;nbsp;&lt;/div&gt;&lt;div style="font-weight: normal; margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: normal; margin-bottom: 0in;"&gt;    &lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;What is reflection and why is it easy in Javascript (you  may need to do research to answer this question)? &lt;/b&gt;  &lt;br /&gt;&lt;div style="font-weight: normal;"&gt;Reflection is the process by which a  computer program can observe and modify its own structure and  behavior at runtime. In non-reflective languages instructions are  executed and data is processed. In javascript, however, program  instructions are also treated as data, and so allows for reflective  program modifications.&lt;/div&gt;&lt;div style="font-weight: normal;"&gt;It is easy in JavaScript because the language allows to add new members/values dynamically to an object/array without the specific member to have been defined as the object/array was created. &lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6471655507948515267-2018279749088202826?l=swissrunner.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://swissrunner.blogspot.com/feeds/2018279749088202826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://swissrunner.blogspot.com/2011/02/assignment-week3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6471655507948515267/posts/default/2018279749088202826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6471655507948515267/posts/default/2018279749088202826'/><link rel='alternate' type='text/html' href='http://swissrunner.blogspot.com/2011/02/assignment-week3.html' title='Assignment - Week3'/><author><name>SwissRunner</name><uri>http://www.blogger.com/profile/14567045470172240780</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6471655507948515267.post-6649219660859265076</id><published>2011-02-05T16:23:00.000-08:00</published><updated>2011-02-06T16:55:16.967-08:00</updated><title type='text'>Assignment - Week2</title><content type='html'>&lt;div class="MsoNormal"&gt;1. Why do languages provide the switch statement, when we can achieve the same thing with multiple if... elseif statements? Show one example of how you might use the switch statement.&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp; Switch Statements:&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;Switch statements are easier to debug, easier to read, easier to understand, and easier to maintain. Also, switch statements are faster to execute. In an if-else statement the compiler has to evaluate each if-else statement beginning from top until it reaches the correct statement this does not occur for a switch statement where the compiler is able to optimize the order of processing each individual case statement.&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;If-elseif-else statement&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Compiler Statement&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;if(value==1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; compare value, 1&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; statement1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jump if zero label 1&lt;/div&gt;&lt;div class="MsoNormal"&gt;elseif(value==2)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; compare value, 2&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; statement2;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jump if zero label2&lt;/div&gt;&lt;div class="MsoNormal"&gt;elseif(value==3)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; compare value, 3&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; statement3;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jump if zero label3&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; label1:&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call statement1&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; label2:&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call statement2&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; label3:&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;switch(value) {&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assembler Statements&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 1:&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; add program_counter, value&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; statement1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call statement1&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call statement2&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 2:&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call statement3&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; statement2;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case 3:&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; statement3;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/div&gt;&lt;div class="MsoNormal"&gt;}&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;2. What is encapsulation, and what do functions encapsulate?&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;Encapsulation means that the internal representation of an object is generally hidden from view outside of the object's definition. Typically, only the object's own methods can directly inspect or manipulate its fields.&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;So, functions encapsulate not only the data but also the members of the object where object members are used to manipulate an object’s data.&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;3. What is a pure function? Is the function show() provided in Eloquent Javascript a pure function? &lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;A pure function has the property that it always returns the same value for the same input, and they have no side effects&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;Yes, the function show() it is a pure function, it should return the same values every time for a given input.&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;4. What do we mean when we say a variable in a function is shadowing a top level variable?&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;Java Script does not provide the same variable scooping rules as other OOP languages do. However, the language provides top and local level variable scooping where the same variable can be declared as a global variable and also as a function variable. Then, as the program executes and a function call is made, where a variable is defined in the function but also in the global space, the function level variable is used for the function execution.&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;&amp;nbsp; &lt;/div&gt;&lt;div class="MsoNormal"&gt;5. A recursive function, must have some sort of an end condition. Why would we get a "out of stack space" error message if a recursive function does not have an end condition?&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;A recursive function is a method where the solution to a problem depends on solutions to smaller instances of the same problem. This means a function calls itself over and over again until the smallest set, a stopping condition, has been reached.&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;As each function call is being made the function is not evaluated, no result is calculated, but put onto the system stack. Once the smallest problem to the question, the stopping condition, has been reached, each function call calls itself over and over again where each call is put yet no actual value is return by each call this only occurs once the last ca yet no function call returns the actual value. So, each function call is stored on the system stack s pulled from the system stack, evaluated, the result handed to the next call, and so fort until all calls have been pulled of the stack and the final result has been calculated.&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;Now assume the smallest problem, or stopping condition, does not exist an infinite number of function calls would be put onto the system stack, so many, until the stack runs out of memory.&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;6. Reflect about the difference between object inheritance and class inheritance&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;The classical approach to creating an object is to define the structure of an object, using a class declaration, and instantiate that class to create a new object. Objects created in this manner have their own copies of all instance attributes, plus a link to the single copy of each of the instance methods.&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;In prototypal inheritance, instead of defining the structure through a class, you simply create an object. This object then gets reused by new objects thanks to the way that prototype chain lookups work. It is called the prototype object because it provides a prototype for what the other objects should look like.&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;7. What is object augmentation, and how do we do it?&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; New members can be added at any time to an object by simple assignment&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; object.attribute=&amp;lt;value&amp;gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;8. There is a way to add a method to String, such as any new String we create will have that augmented method (this is a bit different from object augmentation). How would you do this?&lt;/div&gt;&lt;div class="MsoBodyTextIndent"&gt;According to some online search we will need to use JavaScript’s “Prototype” property. Using this property allows us to add custom made methods/functions to any type of Object.&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.75in; text-align: justify; text-indent: -0.25in;"&gt;1)&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Define a method/function that you would like your object to have. For it to work properly you will need to refer to the object method as “this” within the function.&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 1in; text-align: justify;"&gt;function &amp;lt;name&amp;gt; () {&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 1in; text-align: justify;"&gt; Expressions&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 1in; text-align: justify;"&gt;}&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.75in; text-align: justify; text-indent: -0.25in;"&gt;2)&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Then, use the String object prototype to define your method/function and assign the method/function name to the defined method/function&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in; text-align: justify;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String.prototype.&amp;lt;method-name&amp;gt;=&amp;lt;method-name&amp;gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.75in; text-align: justify; text-indent: -0.25in;"&gt;3)&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Now, create a string object&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 1in; text-align: justify;"&gt;var msg1 = new String(“Test String1”);&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 1in; text-align: justify;"&gt;msg1.&amp;lt;method-name&amp;gt;(); &amp;nbsp;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 1in; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in; text-align: justify;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; or&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 1in; text-align: justify;"&gt;var msg2 = “Test String2”;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 1in; text-align: justify;"&gt;msg2.&amp;lt;method-name&amp;gt;();&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.75in; text-align: justify; text-indent: -0.25in;"&gt;4)&lt;span style="font: 7pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;You can either use a return statement to return a value in the method/function or not and do all work within the method/function&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;9. What is garbage collection?&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;In any OOP language whenever a variable, array, or object is being created. Once that array, object, is not used anymore than that memory needs to be reclaimed or after a while, similarly as in recursion, after too many unused objects are taking up space we will run out of memory. For this reason JavaScript provides garbage collection where arrays, objects, that will not be used anymore are removed from memory.&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;10. What is the difference between an array and an object?&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;In JavaScript Objects and Arrays are very similar, they can be defined and created the same way:&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var arr = new Array();&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var obj = new Object();&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;However, an array is used to represent an ordered collection of numbered values, whereas an&amp;nbsp; object is used to represent an unordered collection of named values, or what is known as an associative array&lt;/div&gt;&lt;div class="MsoNormal" style="margin-left: 0.5in;"&gt;Also, an array has a length method, and an array can inherit attributes from an object but not vice versa.&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;br /&gt;Hi All,&lt;br /&gt;I added the link to the programming assignments&lt;br /&gt;http://jsfiddle.net/swissrunner66/2YjFm/&lt;br /&gt;To execute each program you need to uncomment the: &amp;lt;!-- --&amp;gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6471655507948515267-6649219660859265076?l=swissrunner.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://swissrunner.blogspot.com/feeds/6649219660859265076/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://swissrunner.blogspot.com/2011/02/assignment-week2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6471655507948515267/posts/default/6649219660859265076'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6471655507948515267/posts/default/6649219660859265076'/><link rel='alternate' type='text/html' href='http://swissrunner.blogspot.com/2011/02/assignment-week2.html' title='Assignment - Week2'/><author><name>SwissRunner</name><uri>http://www.blogger.com/profile/14567045470172240780</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6471655507948515267.post-8036831934101904920</id><published>2011-01-30T12:29:00.000-08:00</published><updated>2011-01-30T21:44:25.563-08:00</updated><title type='text'>Week1</title><content type='html'>&lt;ol&gt;&lt;li&gt;&lt;div style="margin-bottom: 0in;"&gt;What is a type, and why do you  think types are useful in writing programs?   &lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;A type specifies the type of a  specifically declared variable/string/array/object&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;It refers to a specific value,  number/boolean/string/array/object a user/program can define and  manipulate in a program.&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="margin-bottom: 0in;"&gt;Why do we lose precision when  performing operations with decimal numbers in Javascript? Can you  think of a few implications of why this would be a problem?   &lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;In javaScript numbers are stored as  64bits. Some of those bits are reserved based on the numerical  value, which means there are only some 50bits available to encode a  numerical value.   &lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;Precission is lost for decimal values  if the complete decimal value cannot be stored in the available  bits.&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;For example the number of PI has an  infinite number of decimal values and so the complete number cannot  be stored in the available bits and so some precision is lost.&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="margin-bottom: 0in;"&gt;Do you understand why the  following operation produces the given result 115 * 4 - 4 + 88 / 2 =  500   &lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;javaScript, like many other  programming languages, support order of precedence, ie. the order of  which mathematical operations are performed.&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;In javaScript we follow the order:   &lt;/div&gt;&lt;ol&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Arial;"&gt;&lt;span style="font-size: x-small;"&gt;"PEMDAS",   →   Parentheses, Exponents, Multiplication and Division, and   Addition and Subtraction&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;(((115*4) – 4) + (88/2)) = 500&lt;/div&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt;&lt;ol start="4"&gt;&lt;li&gt;&lt;div style="margin-bottom: 0in;"&gt;What is the use of a backslash  character in a String?   &lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;A backslash in a string indicates that  the character following the backslash has a special meaning. Special  meaning of characters can be looked up from the ASCII table.&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="margin-bottom: 0in;"&gt;What does &lt;code&gt;typeof 4.5&lt;/code&gt;  do, and why does &lt;code&gt;typeof (typeof 4.5)&lt;/code&gt; return "string"  ?&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;typeof    Specifies the type if the  operand passed to the operator&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;typeof 4.5  Returns the type of the  variable → number&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;typeof(typeof(4.5)   Returns the type  of the returned operand type&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;typeof(typeof(4.5) → number) → string&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;The author writes &lt;i&gt;When your browser loads a page, it  creates a new environment and attaches these standard values to it.  The variables created and modified by programs on that page survive  until the browser goes to a new page.&lt;/i&gt;. Without searching on the  net, can you think of some variables that might be created in the  browsers environment when it loads a page with Javascript in it?   &lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="margin-bottom: 0in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I assume that everything that has been defined between the tags &amp;lt;script&amp;gt; …... &amp;lt;/script&amp;gt; →&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; javaScript are created when the object window is loaded. So far, in our small programs we have&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; used variables  like var, used methods like promp/write/functions/etc.   &lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; All this is loaded when the window loads.&lt;br /&gt;&lt;br /&gt;Coding Assignments Week1 &lt;br /&gt;http://jsfiddle.net/swissrunner66/Lnc26/9/&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6471655507948515267-8036831934101904920?l=swissrunner.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://swissrunner.blogspot.com/feeds/8036831934101904920/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://swissrunner.blogspot.com/2011/01/week1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6471655507948515267/posts/default/8036831934101904920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6471655507948515267/posts/default/8036831934101904920'/><link rel='alternate' type='text/html' href='http://swissrunner.blogspot.com/2011/01/week1.html' title='Week1'/><author><name>SwissRunner</name><uri>http://www.blogger.com/profile/14567045470172240780</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6471655507948515267.post-5678052447390325297</id><published>2011-01-11T22:50:00.001-08:00</published><updated>2011-01-15T16:26:00.054-08:00</updated><title type='text'>javaScript 101</title><content type='html'>&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6471655507948515267-5678052447390325297?l=swissrunner.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://swissrunner.blogspot.com/feeds/5678052447390325297/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://swissrunner.blogspot.com/2011/01/javascript-101-blog-info.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6471655507948515267/posts/default/5678052447390325297'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6471655507948515267/posts/default/5678052447390325297'/><link rel='alternate' type='text/html' href='http://swissrunner.blogspot.com/2011/01/javascript-101-blog-info.html' title='javaScript 101'/><author><name>SwissRunner</name><uri>http://www.blogger.com/profile/14567045470172240780</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry></feed>
