customer obsession
ownership
invent and simplify
are right, a lot
curious
hire and develop the best
insist on highest standards
think big
bias for action
frugality
earn trust
dive deep
have backbone, disagree and commit
deliver results
JavaScript
/*-----------------------------------------------------------------------------
Write code on the whiteboard that could take user input and determine if it is a palindrome
-----------------------------------------------------------------------------
function checkPalindrom(str) {
return str == str.split('').reverse().join('');
}
console.log(checkPalindrom('racecar'));
-----------------------------------------------------------------------------
Write a function fib() that a takes an integer n and returns the nth fibonacci number. Let's say our fibonacci series is 0-indexed and starts with 0.
*
* i.e.
* fib(0) = 0
* fib(1) = 1
* fib(6) = 8
* fib(36) = ??
*
* The Fibonacci series is a numerical series where each item is the sum of the two previous items. It starts off like this: 0,1,1,2,3,5,8,13,21...
-----------------------------------------------------------------------------
var fibonacci = function() {
var memo = [0,1];
var fib = function(n) {
if (typeof result === 'undefined') {
memo[n] = fib(n-2) + fib(n-1);
}
return memo[n];
}
return fib;
}();
-----------------------------------------------------------------------------
Take two arrays and compare them to find duplicates. Only list each duplicate once.
-----------------------------------------------------------------------------
var array1 = [1,2,3,4,5,6,7];
var array2 = [2,3,4,324,5436,15];
function detectDupe(arr1, arr2) {
var tmp = [];
arr1.forEach(function(item, idx, arr1) {
if (arr2.indexOf(item) !== -1) {
tmp.push(item);
}
});
return tmp;
}
console.log(detectDupe(array1, array2));
-----------------------------------------------------------------------------
Make this work: duplicate([1,2,3,4,5]); // [1,2,3,4,5,1,2,3,4,5]
-----------------------------------------------------------------------------
var given = [1,2,3,4,5];
function duplicate(arr) {
var tmp = arr;
arr.forEach(function(item, idx, arr) {
tmp.push(item);
});
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.