https://github.com/rodrigo-dev7/arraysjsuse
Algumas formas de se utilizar Array em javascript
https://github.com/rodrigo-dev7/arraysjsuse
arrays filter find foreach forof javascript map
Last synced: about 1 year ago
JSON representation
Algumas formas de se utilizar Array em javascript
- Host: GitHub
- URL: https://github.com/rodrigo-dev7/arraysjsuse
- Owner: Rodrigo-dev7
- Created: 2020-05-11T00:07:34.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-11T00:14:29.000Z (almost 6 years ago)
- Last Synced: 2025-02-08T08:32:47.401Z (about 1 year ago)
- Topics: arrays, filter, find, foreach, forof, javascript, map
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ALGUMAS FORMAS DE USAR ARRAYS NO JavaScript.
Veja algumas formas de se utilizar.
- Map
```
const celsius = [0, 23, 30, 41, 68, 14];
const toFahrneheit = value => ((value * 9) / 5) + 32;
const temperatureFahrneheit = celsius.map(toFahrneheit);
console.log(celsius)
console.log(temperatureFahrneheit)
```
- Filter
```
const nums = [2, 4 , 76, 98, 121, 207, 404]
const par = nums.filter((value) => {
return value % 2 == 0
})
console.log(par)
```
- Find
```
const sobremesas = [{
nome: 'pudim',
diet: true,
},
{
nome: 'gelatina',
diet: false,
},
{
nome: 'Bolo de chocolate',
diet: true,
},
{
nome: 'pavê',
diet: false,
},
];
const inDiet = sobremesas.find(item => {
return item.diet
})
console.log(inDiet)
```