General interview questions for a front-end JS developer.
-
What is the spec Javascript implements and what versions of it are you most current with?
-
Does JavaScript support the use of classes?
api.find = function (model, options, conditions) { | |
console.info(options); // {limit: 1} | |
return new RSVP.Promise(function (resolve, reject) { | |
console.info(options); // undefined WTF?! | |
var options = options || {}, | |
defaults = { | |
limit: null, | |
offset: null, | |
orderBy: null, | |
direction: null |
/** | |
* Helper for currying a function. | |
* | |
* ### Usage | |
* | |
* ```javascript | |
* // Some function you want to partially apply | |
* function someFunc(a, b, c, d) {return arguments;} | |
* | |
* // Curry the function |
var user = ORM.factory('user'); | |
user.where(function (user) { | |
user.where('id').between(1, 10); | |
}).orWhere(function (user) { | |
user.where('id').between(100, 200); | |
}).orWhere({ | |
active: true, | |
banned: false | |
}).findAll(); |
/** | |
* This is a WIP of potential usage of the ORM in a NodeJS implementation. Let's try implementing | |
* this as a module for other parts of the app to use. Less instantiation for later | |
*/ | |
var ORM = require('awesomeorm-base'), | |
repository = require('awesomeorm-repository-rest')('http://rest.example.com/schema'), | |
dataParser = require('awesomeorm-data-jsonapi'), | |
modelBuilder = require('awesomeorm-model-encasulated'); | |
/*! | |
* jQuery JavaScript Library v1.4.1 | |
* http://jquery.com/ | |
* | |
* Copyright 2010, John Resig | |
* Dual licensed under the MIT or GPL Version 2 licenses. | |
* http://jquery.org/license | |
* | |
* Includes Sizzle.js | |
* http://sizzlejs.com/ |
alert('Oh snap!'); |
Unit Tests | |
Internal Caching | |
✓ Should throw an exception when trying to get a key that doesn't exist | |
✓ Should set and retrieve a key from the cache | |
✓ Should delete a key from the cache | |
Helpers | |
hasTagType() | |
✓ Should return the index of an array where a tag type exists | |
✓ Should return false if the type is not found | |
mergeTagsWithDefault() |
/** | |
* Gets the dependent keys of the computed proerpty | |
* @return {array} Array of dependent keys | |
*/ | |
ComputedPropertyPrototype.getDependentKeys = function() { | |
// Create a new container to pass by value | |
var newArray = []; | |
// Add the keys to the container | |
for (var i = this._dependentKeys.length - 1; i >= 0; i--) { |
Make answers to the following problems below using PHP. For now, you can psuedocode the methods with comments, or you can create your own implementations if you feel adventurous. Use any resources you like. Also, one thing I forgot to mention in your lesson: there is a naming convention for things in classes. If a name starts with a single