https://github.com/customcommander/screening
Stuffs you expect interviewees to know
https://github.com/customcommander/screening
Last synced: 5 months ago
JSON representation
Stuffs you expect interviewees to know
- Host: GitHub
- URL: https://github.com/customcommander/screening
- Owner: customcommander
- Created: 2014-07-16T14:30:47.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-09-22T10:28:48.000Z (almost 12 years ago)
- Last Synced: 2025-04-09T17:47:39.727Z (about 1 year ago)
- Size: 168 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
0. What's the difference between `call()` and `apply()`?
How and why would you use them?
0. Write a function that tells me if a word is an anagram or a palindrome of another word.
A palindrome is a word that you can read both ways (e.g. `abba`).
An anagram is a word that contains every letters of another word (e.g. `rome` and `more`).
Example:
```javascript
is_anagram_or_palindrome(word_a, word_b); // true or false
```
NB: You don't need to do parameters validation.
0. One of these assertions will fail. Which one and why?
```javascript
// Returns true if thing is an object
function is_object(thing) {
return thing && Object.prototype.toString.call(thing) === '[object Object]';
}
console.assert(is_object([]) === false , 'assert #1');
console.assert(is_object({}) === true , 'assert #2');
console.assert(is_object(null) === false , 'assert #3');
console.assert(is_object(new function () {}) === true, 'assert #4');
```
0. This is the content of a file named **foo.js**:
```javascript
function foo() {
(function () {
alert('hello world');
})();
}
```
And this is **foo.html**:
```html
```
What happens when **foo.html** is loaded in a web browser?
0. What is the output of the following program?
```javascript
function foo() {
return new bar();
}
function bar() {
return {};
}
function baz() {
}
var a = new foo();
var b = new bar();
var c = new baz();
try {
console.log('#1: ', a instanceof foo ? 'yes' : 'no');
console.log('#2: ', a instanceof bar ? 'yes' : 'no');
console.log('#3: ', b instanceof bar ? 'yes' : 'no');
console.log('#4: ', c instanceof baz ? 'yes' : 'no');
} catch (e) {
console.log('err!');
}
```
0. Which of the following assertions will fail?
```javascript
function assert_equal(a, b, message) {
if (a !== b) {
console.log(message);
}
}
assert_equal(true , true , 'test #1');
assert_equal(true , 1 , 'test #2');
assert_equal([1,2] , [1,2] , 'test #3');
assert_equal({} , {} , 'test #4');
assert_equal(10 , '10' , 'test #5');
assert_equal('foo' , 'foo' , 'test #6');
assert_equal(Infinity, Infinity , 'test #7');
assert_equal(null , undefined, 'test #8');
assert_equal(NaN , NaN , 'test #9');
assert_equal(1.0 , 1 , 'test #10');
```