Skip to content

Commit cfb8004

Browse files
committed
updated
1 parent 8c65ac8 commit cfb8004

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

JavaScript Problem Solving/veryEasy.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,41 @@ function nSidedShape(n) {
113113
Return the Total Number of Parameters
114114
Create a function that returns the total number of parameters passed in.
115115
Note: How can you express the input parameter so it takes a variable number of arguments?
116+
Note: Used the spread
116117
////////////////////////////////////////////////////////////////////
117118
*/
118119
function numberArgs(...args) {
119120
return arguments.length;
121+
}
122+
123+
124+
125+
/*
126+
ES6: Destructuring Arrays III
127+
You can assign variables from arrays with destructuring like this:
128+
const arr = ["eyes", "nose", "lips", "ears"]
129+
let [eyes, nose, lips, ears] = arr
130+
*/
131+
132+
133+
134+
135+
/*
136+
Stack the Boxes
137+
Here's an image of four models. Some of the cubes are hidden behind other cubes. Model one consists of one cube. Model two consists of four cubes, and so on...
138+
Write a function that takes a number n and returns the number of stacked boxes in a model n levels high, visible and invisible.
139+
*/
140+
function stackBoxes(n) {
141+
return Math.pow(n, 2);
142+
}
143+
144+
145+
/*
146+
Array of Word Lengths
147+
Create a function that takes an array of words and transforms it into an array of each word's length.
148+
*/
149+
function wordLengths(arr) {
150+
return arr.map(function(word) {
151+
return word.length;
152+
});
120153
}

investigationNotes.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"use strict";
2+
// TOPIC /////////////////////////////////////////////////////////////////////////////////////////////////////
3+
//
4+
// Investigation Notes.
5+
//
6+
// NOTES /////////////////////////////////////////////////////////////////////////////////////////////////////
7+
// 1. A handy list of concepts, tools, and skills to look further into as I investigate JavaScript recipes.
8+
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
9+
10+
11+
1. Destructuring arrays and objects.
12+
=================
13+
Used this a few times with arrays and objects, but I'd like to get a better grasp of it. Last time I used it investigate
14+
when I cam across a question in edabits.
15+
16+
17+
* https://hacks.mozilla.org/2015/05/es6-in-depth-destructuring/
18+

0 commit comments

Comments
 (0)