Questions and Answers
Problems and Solutions
Quotes help make search much faster. Example: "Practice Makes Perfect"
Saturday, May 13, 2017
FreeCodeCamp Drop It Sample Solution
function dropElements(arr, func) {
// Drop them elements.
for(var i=0; i<arr.length; i++){
if([arr[i]].filter(func)>0){
return arr.slice(i,arr.length);
}
}
return [];
}
dropElements([1, 2, 3, 9, 2], function(n) {return n > 2;});
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
This is an example of
scrolling text
using Javascript.
Popular Posts
Codecademy - Animate Your Name: Arrays
//Sample solution to main.js var red = [0, 100, 63]; var orange = [40, 100, 60]; var green = [75, 100, 40]; var blue = [196, 77, 55]; ...
Codecademy Learn Phaser: Keyboard Events 10/12
//Sample Solution const gameState = {} function preload() { this.load.image('codey', 'https://s3.amazonaws.com/codecademy-...
Codecademy Sample Solution: Final Push
$VERBOSE = nil # We'll explain this at the end of the lesson. require 'prime' # This is a module. We'll cover these s...
Make a Website: HTML Wrap with a div 5/9
<!-- Sample solution to index.html --> <!DOCTYPE html> <html> <body> <div class="nav"> ...
Codefights isMAC48Address(inputString)
//sample solution function isMAC48Address(inputString) { if(inputString.length!=17){ return false; } var regex = /^([0-9A...
Codeschool Sample Solution Removing the clicked button
$(document).ready(function(){ $("button").on("click", function(){ var message = $("<span>Call 1-555-...
Codecademy - Animate Your Name: Discover the length
Sample Solution: //document.write( "Ryan" ); document.write( " The length of Ryan is "); document.write( "Ryan...
LearnStreet Sample Solution Sudoku Solver Project Method 8
function isSolved(sudoku) { // A sudoku will be solved if all its rows, columns and blocks are correct. // Use a combination of t...
LearnStreet Sample Solution Sudoku Solver Project Method 1
// Sudoku Solver Project function isPossibleRow(sudoku, row, number) { // This isPossibleRow() function returns true if the 'numbe...
Math Problems: Collatz Function
Problem: The Collatz function is defined as f(n) = 3n+1 for odd values of n and f(n) = n/2 for even values of n. What is the smallest poss...
No comments:
Post a Comment