G
Garrett Smith
Hi Everybody,
What is your most challenging interview question?
Mine:
"What do you think of jQuery?"
What is your most challenging interview question?
Mine:
"What do you think of jQuery?"
Hi Everybody,
What is your most challenging interview question?
Mine:
"What do you think of jQuery?"
Garrett said:Hi Everybody,
What is your most challenging interview question?
Mine:
"What do you think of jQuery?"
Ry said:A: It's a library that attempts to provide a better browser API.
Attempted and failed (miserably). Have you looked at their API? It's
not just the innards that stink with that thing, the crust is garbage
too. Or was that supposed to be a disingenuous answer?
It's the truth, and a very diplomatic way of putting it, imo.
It is a question that is going to need a very diplomatic answer in
that context. I would probably go for something along the lines of;
it is pretty much what you would expect given the relative
understanding of javascript and browser scripting experience of its
designer(s). That is fully open to interpretation (including a
positive interpretation), but if pursued invites the justification
that would prevent the answer sounding bigoted.
Hi Everybody,
What is your most challenging interview question?
Q: How would you implement a constructor that inherits a method from
it's prototype that has access to it's instance private variables? In
other words if I had:
function Foo(a){
...
var _foo = a
...
}
how would you use prototypical inheritance so that the following is
possible:
var obj1 = new Foo("one"),
obj2 = new Foo("two");
obj1.thing() //"one"
obj2.thing() //"two"
Is this thread the discussion of jQuery library or I missed
something?
Or is it about "The Most Challenging Interview Question"?
(just want to warn irrelevant discussion on 10 pages in the
100-th time repeating all the same about jQuery).
If you going to make interview and test the candidates for work,
you should do this depending on your current project(s) (if the
project is big and isn't being changed in a time -- year or two).
Of course there is a sense to test the basic (but deep) knowledge
of the technology as well.
Don't forget that questions are depended on the type of the
position. If this is position of some theoretical analytic
than of course there is a sense to ask some deep theoretical
question. If the position is mostly practical and you still
want to test some more-less deep knowledge, then can be
questions related on features of the technology.
The simplest but allowing to test whether the candidate
understands what he's taking about e.g.
"What does result alert(this)?"
without mentioning the context of the question -- let the
candidate will explain all this himself.
Or, more practical:
"Let there is an array. How to remove all elements with
value 3 from it?"
this question allows to check whether the candidate knows
that "length" is being modified every time when he will be
splicing/deleting items, and therefore direct for-loop
isn't fit.
I can propose a very deep theoretical question which will fail the
candidate -- but what the sense if we need a good practical
programmer?
So, all this depends.
Of course, question on philosophy (such as yours -- about
jQuery) can be also.
<snip>Q: How would you implement a constructor that inherits a method from
it's prototype that has access to it's instance private variables?
Q: How would you implement a constructor that inherits a method from
it's prototype that has access to it's instance private variables? In
other words if I had:
function Foo(a){
...
var _foo = a
...
}
how would you use prototypical inheritance so that the following is
possible:
var obj1 = new Foo("one"),
obj2 = new Foo("two");
obj1.thing() //"one"
obj2.thing() //"two"
Q: How would you implement a constructor that inherits a method from
it's prototype that has access to it's instance private variables? In
other words if I had:
Hi Everybody,
What is your most challenging interview question?
Mine:
"What do you think of jQuery?"
Q: How would you implement a constructor that inherits a method from
it's prototype that has access to it's instance private variables? In
other words if I had:function Foo(a){
...
var _foo = a
...
how would you use prototypical inheritance so that the following is
possible:var obj1 = new Foo("one"),
obj2 = new Foo("two");obj1.thing() //"one"
obj2.thing() //"two"
I'll bite...
var clase= (function claseBuilder () {
var instances= [];
var getters= [];
var clase= {};
clase.getPrivate= function () {
return getters[instances.indexOf(this)]();
};
clase.pushGetter= function (instance, getter) {
instances.push(instance);
getters.push(getter);
};
return clase;
})();
function subclase (private) {
o= {};
o.__proto__= clase;
clase.pushGetter(o, function () { return private });
return o;
}
var a= subclase(33);
var b= subclase(27);
[a.hasOwnProperty("getPrivate"), a.hasOwnProperty("getPrivate")]
--> [ false, false ]
[a.getPrivate(), b.getPrivate()]
--> [ 33, 27 ]
I'll bite...
var clase= (function claseBuilder () {
var instances= [];
var getters= [];
var clase= {};clase.getPrivate= function () {
return getters[instances.indexOf(this)]();
};clase.pushGetter= function (instance, getter) {
instances.push(instance);
getters.push(getter);
};return clase;
function subclase (private) {
o= {};
o.__proto__= clase;
clase.pushGetter(o, function () { return private });
return o;
var a= subclase(33);
var b= subclase(27);[a.hasOwnProperty("getPrivate"), a.hasOwnProperty("getPrivate")]
--> [ false, false ]
[a.getPrivate(), b.getPrivate()]
--> [ 33, 27 ]
Version 2:
var subClase;
var clase= (function claseBuilder (instances, getters, clase) {
clase.getPrivate= function () {
return getters[instances.indexOf(this)]();
};
subClase= function subClaseBuilder (private, o) {
(o= {}).__proto__= clase;
instances.push(o);
getters.push(function () { return private });
return o;
};
return clase;
})([], [], {});
var a= subClase(33);
var b= subClase(27);
[a.hasOwnProperty("getPrivate"), b.hasOwnProperty("getPrivate")]
--> [ false, false ]
[a.getPrivate(), b.getPrivate()]
--> [ 33, 27 ]
On May 7, 2:54 pm, "Michael Haufe (\"TNO\")"
Hi Everybody,
What is your most challenging interview question?
Q: How would you implement a constructor that inherits a method from
it's prototype that has access to it's instance private variables? In
other words if I had:
function Foo(a){
...
var _foo = a
...
}
how would you use prototypical inheritance so that the following is
possible:
var obj1 = new Foo("one"),
obj2 = new Foo("two");
obj1.thing() //"one"
obj2.thing() //"two"
I'll bite...![]()
var clase= (function claseBuilder () {
var instances= [];
var getters= [];
var clase= {};
clase.getPrivate= function () {
return getters[instances.indexOf(this)]();
};
clase.pushGetter= function (instance, getter) {
instances.push(instance);
getters.push(getter);
};
return clase;
})();
function subclase (private) {
o= {};
o.__proto__= clase;
clase.pushGetter(o, function () { return private });
return o;
}
var a= subclase(33);
var b= subclase(27);
[a.hasOwnProperty("getPrivate"), a.hasOwnProperty("getPrivate")]
--> [ false, false ]
[a.getPrivate(), b.getPrivate()]
--> [ 33, 27 ]Version 2:var subClase;
var clase= (function claseBuilder (instances, getters, clase) {
clase.getPrivate= function () {
return getters[instances.indexOf(this)]();
};
subClase= function subClaseBuilder (private, o) {
(o= {}).__proto__= clase;
instances.push(o);
getters.push(function () { return private });
return o;
};
return clase;})([], [], {});var a= subClase(33);
var b= subClase(27);[a.hasOwnProperty("getPrivate"), b.hasOwnProperty("getPrivate")]
--> [ false, false ]
[a.getPrivate(), b.getPrivate()]
--> [ 33, 27 ]
Version 3:
This one, however, duplicates the private values, which is not a Good
Idea™, i.e. if private were a 150MB string... BAD.
var subClase;
var clase= (function claseBuilder (instances, values, clase) {
clase.getPrivate= function () {
return values[instances.indexOf(this)];
};
subClase= function subClaseBuilder (private, o) {
(o= {}).__proto__= clase;
instances.push(o);
values.push(private);
return o;
};
return clase;
})([], [], {});
var a= subClase(33);
var b= subClase({});
[a.hasOwnProperty("getPrivate"), b.hasOwnProperty("getPrivate")]
--> [ false, false ]
[a.getPrivate(), b.getPrivate()]
--> [ 33, {} ]
nick said:Argh! "Its" ... "its" ... "its."
It's a declension. Not possessive, not a contraction. Like "his" or
"her," it needs no apostrophe.
This mistake has it's opponents but really its no big deal.![]()
Michael said:An addendum for those playing at home and want to try: the "thing()"
method should be declared only once.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.