This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fileNames = { | |
file1: "file.doc", | |
file2: "file.xls", | |
file3: "file.jpeg" | |
} | |
const getExtension = file => file.slice(file.lastIndexOf('.') + 1) | |
[...Object.values(fileNames)] | |
.map(el => getExtension(el)) //["doc", "xls", "jpeg"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const random = ( min = 0, max = 10 ) => Math.floor( Math.random() * ( max - min ) + min ) | |
console.log(random()) | |
console.log(random( -10, 10 )) | |
console.log(random( 50, 250 )) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="filter keys"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>filter keys</title> | |
<style id="jsbin-css"> | |
span { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const data = [ | |
{ name: "user1" , age: "20"}, | |
{ name: "user2" , age: "20"}, | |
{ name: "user1" , age: "20"}, | |
{ name: "user2" , age: "10"} | |
] | |
const filter = (data, type, field = "name") => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const obj = [ | |
{ | |
nome: 'User1', | |
cpf: '000.000.000-00', | |
time: 1000, | |
result: 0, | |
}, | |
{ | |
nome: 'User2', | |
cpf: '111.000.000-00', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const data = [ | |
{ | |
product_id: '2', | |
category_id: '13', | |
description: 'Anxious Armadillo', | |
price: '133', | |
quantity: '339', | |
}, | |
{ | |
product_id: '20', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const obj = [{ | |
nome: "User1", | |
cpf: "000.000.000-00", | |
time: 1000, | |
result: 0 | |
}, | |
{ | |
nome: "User2", | |
cpf: "111.000.000-00", | |
time: 1200, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arr = ['z', 'b', 'a'] | |
const arr2 = [20, 10, 8, 30] | |
const arr3 = [{ | |
name: "z", | |
job: "b" | |
}, { | |
name: "b", | |
job: "a" | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const data = [ | |
{ "itemSelected": "item1", "data": "2017-09-12", "descricaoPrestacao": "desc1 item1", "valor": 1 }, | |
{ "descricaoPrestacao": "desc2 item2", "valor": 2, "itemSelected": "item2", "data": "2017-09-12" }, | |
{ "descricaoPrestacao": "desc3 item3", "valor": 3, "itemSelected": "itemMIL", "data": "2017-09-12" }, | |
{ "descricaoPrestacao": "desc2 item1", "valor": 1, "itemSelected": "item1", "data": "2017-09-12" }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const interval = (id, time = 1000) => { | |
const el = [] | |
const start = () => { | |
el[id] = setInterval(() => { | |
console.log(`${new Date().toLocaleTimeString()} Identificador ${id}\n`) | |
}, time) | |
} |