"JavaScript enclosures"?

i think it has to do with encapsulating your code inside a function so
that all vars are inside the function's scope, so not cluttering the
global namespace.
This, to avoid memory leak.

something the likes:

(function(){
/// your code goes here

})(jquery);

I have absolutely no idea if this bits-and-pieces knowledge of mine is
any good, or even if it makes sense :)



On Tue, Dec 30, 2008 at 6:14 AM, Angel Marquez <angel.marq...@gmail.com> wrote:
> haha
> they are contemplating hiring me!
> I already sent it back and thought I'd post it here to see the response.
> Appreciate it.
> I think my answers were correct..
> The first argument method is 'void', correct?
>
> On Mon, Dec 29, 2008 at 9:07 PM, Michael Geary <m...@mg.to> wrote:
>>
>> Huh?
>>
>> Are you writing these questions, or you've been given them to answer and
>> you're looking for help answering them, or what?
>>
>> If you're looking for the answers, is the potential employer
>> contemplating hiring you, or hiring the rest of us in this group? :-)
>>
>> The list seems to be first and foremost a test to weed out older
>> candidates. You need mighty good eyes to read that tiny font!
>>
>> Anyway, let me skip right to the end:
>>
>> BONUS 7: (Super-impressive) Q: Can you summarize the definition of
>> "JavaScript enclosures"?
>>
>> No, I can't. Can you? What the heck is a "JavaScript enclosure"?
>>
>> -Mike
>>
>> p.s. Is there anything to do with jQuery here?
>>
>> ________________________________
>> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
>> Behalf Of Angel Marquez
>> Sent: Monday, December 29, 2008 7:48 PM
>> To: jquery-en@googlegroups.com
>> Subject: [jQuery] HELP: Screening questions for JavaScript developer
>> candidates:
>>
>> (required) Q: Describe the difference in result of the JavaScript DOM
>> methods getElementById and getElementsByClassName.
>>
>> 2. (required) Given this JavaScript statement:
>>
>>        objXHR.open('GET',' HYPERLINK "http://"; http://myURL.com',true);
>>
>>         a. Q: What, probably, is the type of the object named "objXHR"?
>>
>>         b. Q: What is the purpose of each of the parameters being passed
>> to the "open" method?
>>
>> Q: If an absolute URL is passed in the second argument, what kind of
>> restriction usually applies?
>>
>>    3. (required) How would you (a) declare and then (b) instantiate a
>> JavaScript class to describe a "Square" object, taking one argument in its
>> constructor?  The instance of a Square should have sides 4 units in length.
>> ( c )What properties might a Square object have and how would they be coded?
>>
>>         a. declare: function Square(numericSideArgument) {
>>                             ... (some other stuff)
>>                             }
>>         b. use: var mySquare = new Square(4);
>>         c. methods: perimeter, coded as "this.perimeter =
>> numericSideArgument * 4;"
>>                               area, coded as "this.area =
>> numericSideArgument ^ 2;" (squared, i.e. width * height)
>>         So, the whole definition of Square would be:
>>
>>                             function Square(numericSideArgument) {
>>
>>                            this.perimeter = numericSideArgument * 4;
>>                             this.area = numericSideArgument ^ 2;
>>                             return this;
>>
>>                            }
>>
>>                             So, Q: "mySquare.perimeter" would equal?
>>
>>  Q: "mySquare.area" would equal ?
>>
>>   4. (desired) An object called "auto" has an "id" attribute with value of
>> "taurus" and a "color" attribute with value "blue".  Additionally, it has a
>> child object "radio", which contains an array "knob" which contains three
>> items with names and shapes:
>>
>> name: power, shape: round
>>
>> name: tune, shape: oval
>>
>> name: scan, shape: square
>>
>> Q: What does the acronym JSON stand for?
>> Q: What does this object look like in JSON?
>>
>>    BONUS 5. (CSS-related) Describe the difference between a <DIV> element
>> versus a <SPAN>.
>>
>>    BONUS 6. (Advanced JavaScript and YUI) If I have a JavaScript
>> collection object "YAHOO.util.Dom" with a member method "setStyle" that
>> takes three arguments
>>
>> "an array of element id's"
>>
>> "a css property name", and
>>
>> "a single float value",
>>
>> ...Q: how would I write the single line of JavaScript that sets the
>> transparency of DIV's "layer1" and "layer2" to "66%"?
>>
>>         Q: How would I write the single line of JavaScript that sets the
>> background color of only DIV "layer1" to hexadecimal "black"?
>>
>>         Q: If there was another method which DID take a single-value,
>> non-array, in that first argument, in object-oriented terminology, the
>> method would be said to be "what"?
>>
>>         Q: Does JavaScript support overloading?
>>
>>         BONUS 7: (Super-impressive) Q: Can you summarize the definition of
>> "JavaScript enclosures"?
>
>

Reply via email to