Tuesday November 3
Daily JS
JS Quiz
Instructions
Given the code below, write code to make the digitize
function work.
The function should perform the following:
- Given a non-negative integer, return an array / a list of the individual digits in order.
Slack me a direct message of your attempt.
Methods to Look Up
- Number.prototype.toString()
- String.prototype.split
function digitize(n) {
// Your code goes here
}
console.assert(digitize(123)[0] === 1);
console.assert(digitize(8675309)[6] === 9);
Class & Lab & Homework
Videos
First watch these videos on a few of the different Array functions that are available (we briefly used reduce
in the example problem with Credit Cards).
- https://egghead.io/lessons/javascript-introducing-reduce-transforming-arrays-functionally
- https://egghead.io/lessons/javascript-introducing-reduce-reducing-an-array-into-an-object
https://egghead.io/lessons/javascript-introducing-reduce-common-patterns
https://egghead.io/lessons/javascript-the-array-foreach-method
- https://egghead.io/lessons/javascript-the-array-map-method
- https://egghead.io/lessons/javascript-the-array-filter-method
- https://egghead.io/lessons/javascript-chaining-the-array-map-and-filter-methods
- https://egghead.io/lessons/javascript-create-an-array-concatall-method
Today while I am out, work on your homework (most of it should be graded up to last night), then read through the resources here in the Gitbook. I expect for you to have questions and a list of topics that you would like to review or that I need to finish writing here in the Gitbook. Slack me these in a direct message.