Browse Source

docs(using-map): correct grammar

1124-swap-args-test
davhojt 2 years ago committed by Dav Hojt
parent
commit
65b8b5df02
  1. 44
      subjects/using-map/README.md

44
subjects/using-map/README.md

@ -2,10 +2,13 @@
### Instructions ### Instructions
- Create a function named `citiesOnly` which takes an array of objects and which return an array of strings from the key `city`. Create the following functions:
#### Example: > Your solutions **must** use `map`.
#### Cities Only
`citiesOnly`: accepts an array of objects and returns an array of strings from the `city` key.
```js ```js
citiesOnly([ citiesOnly([
{ {
@ -19,34 +22,20 @@ citiesOnly([
]) // -> ['Los Angeles', 'San Francisco'] ]) // -> ['Los Angeles', 'San Francisco']
``` ```
- Create a function named `upperCasingStates` which takes an array of strings #### Upper Casing States
and which Upper Case the first letter of each word in a string. \ `upperCasingStates`: accepts an array of strings, and returns a new array of strings. The returned array will be the same as the argument, except the first letter of every word must be capitalized.
The function returns then an array of strings.
#### Example:
```js ```js
upperCasingStates(['alabama', 'new jersey']) // -> ['Alabama', 'New Jersey'] upperCasingStates(['alabama', 'new jersey']) // -> ['Alabama', 'New Jersey']
``` ```
- Create a function named `fahrenheitToCelsius` which takes an array #### Fahrenheit to Celsius
of fahrenheit temperatures which converts them to Celsius. `fahrenheitToCelsius`: accepts an array of fahrenheit temperatures as strings, and returns an array of strings converted to celsius. Round down the result.
Round down the result.
The function then returns the result as an array of strings like below:
#### Example:
```js ```js
fahrenheitToCelsius(['68°F', '59°F', '25°F']) // -> ['20°C', '15°C', '-4°C'] fahrenheitToCelsius(['68°F', '59°F', '25°F']) // -> ['20°C', '15°C', '-4°C']
``` ```
- Create a function named `trimTemp` which takes an array of objects #### Trim Temp
and which removes the spaces from the string in the key `temperature`. \ `trimTemp`: accepts an array of objects, and returns a new array of objects with the same structure. The `temperature` strings must have their spaces removed in the new array.
The function then returns an array of objects with the modification.
#### Example:
```js ```js
trimTemp([ trimTemp([
{ city: 'Los Angeles', temperature: ' 101 °F ' }, { city: 'Los Angeles', temperature: ' 101 °F ' },
@ -57,9 +46,8 @@ trimTemp([
] */ ] */
``` ```
- Create a `tempForecasts` function which will take an array of objects, and which will #### Temp Forecasts
return an array of strings formatted as below: `tempForecasts`: accepts an array of objects, and returns an array of formatted strings. See the example below:
```js ```js
tempForecasts([ tempForecasts([
{ {
@ -71,11 +59,7 @@ tempForecasts([
]) // -> ['38°Celsius in Pasadena, California'] ]) // -> ['38°Celsius in Pasadena, California']
``` ```
#### Special instruction
The goal of this exercise is to learn to use `map`, as such all your
solution **MUST** use `map`
### Notions ### Notions
- [devdocs.io/javascript/global_objects/array/map](https://devdocs.io/javascript/global_objects/array/map) - [Array.map](https://devdocs.io/javascript/global_objects/array/map)

Loading…
Cancel
Save