From the FreeCodeCamp intermediate algorithms here: Fill in the object constructor with the following methods below: FreeCodeCamp – Make a Person As with all code there are probably multiple ways to complete this challenge. My feeling is that this solution is quite straightforward, but that perhaps could be just from my own perspective. Somebody elseContinue reading “Make a Person”

# Tag Archives: FreeCodeCamp

## Arguments Optional

From the FreeCodeCamp intermediate algorithms here: Create a function that sums two arguments together. If only one argument is provided, then return a function that expects one argument and returns the sum. For example, addTogether(2, 3) should return 5, and addTogether(2) should return a function. Calling this returned function with a single argument will then return the sum: var sumTwoAndContinue reading “Arguments Optional”

## Everything Be True

From the FreeCodeCamp intermediate algorithms here: Check if the predicate (second argument) is truthy on all elements of a collection (first argument). In other words, you are given an array collection of objects. The predicate pre will be an object property and you need to return true if its value is truthy. Otherwise, return false. In JavaScript, truthy values are values that translate to true when evaluatedContinue reading “Everything Be True”

## Binary Agents

From the FreeCodeCamp intermediate algorithms here: Return an English translated sentence of the passed binary string. The binary string will be space separated. FreeCodeCamp – Binary Agents For this challenge I began by splitting the binary string into an array of the given 8 bit blocks. This would make it a lot easier to workContinue reading “Binary Agents”

## Steamroller

From the FreeCodeCamp intermediate algorithms here: Flatten a nested array. You must account for varying levels of nesting. FreeCodeCamp – Steamroller A quick post today about flattening nested arrays down to one array. However a quick google of ‘flatten nested arrays in javascript’ lead me here. … which essentially takes care of this algorithm forContinue reading “Steamroller”

## Drop It

From the FreeCodeCamp intermediate algorithms here: Given the array arr, iterate through and remove each element starting from the first element (the 0 index) until the function func returns true when the iterated element is passed through it. Then return the rest of the array once the condition is satisfied, otherwise, arr should be returned as an empty array. FreeCodeCamp – DropContinue reading “Drop It”

## Smallest Common Multiple

From the FreeCodeCamp intermediate algorithms here: Find the smallest common multiple of the provided parameters that can be evenly divided by both, as well as by all sequential numbers in the range between these parameters. The range will be an array of two numbers that will not necessarily be in numerical order. For example, ifContinue reading “Smallest Common Multiple”

## Sum All Primes

From the FreeCodeCamp intermediate algorithms here: A prime number is a whole number greater than 1 with exactly two divisors: 1 and itself. For example, 2 is a prime number because it is only divisible by 1 and 2. In contrast, 4 is not prime since it is divisible by 1, 2 and 4. Rewrite sumPrimes so it returnsContinue reading “Sum All Primes”

## Sum All Odd Fibonacci Numbers

From the FreeCodeCamp intermediate algorithms here: Given a positive integer num, return the sum of all odd Fibonacci numbers that are less than or equal to num. The first two numbers in the Fibonacci sequence are 1 and 1. Every additional number in the sequence is the sum of the two previous numbers. The first six numbersContinue reading “Sum All Odd Fibonacci Numbers”

## Convert HTML Entities

From the FreeCodeCamp intermediate algorithms here: Convert the characters &, <, >, ” (double quote), and ‘ (apostrophe), in a string to their corresponding HTML entities. FreeCodeCamp – Convert HTML Elements For this task there will certainly be other ways to complete it. However although the code may look slightly long, it did not take a long time to write out. TheContinue reading “Convert HTML Entities”