Skip to content

Instantly share code, notes, and snippets.

@mgreich
Created March 23, 2018 22:04
Show Gist options
  • Save mgreich/ceb85e046ff9788b951bf58e7ebe53bb to your computer and use it in GitHub Desktop.
Save mgreich/ceb85e046ff9788b951bf58e7ebe53bb to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/maduwe
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
const contracts = {
111: {name: "contract111"},
222: {name: "contract222"},
333: {name: "contract333"},
444: {name: "contract444"},
}
const contractIds = [111, 333]
const myContracts = contractIds.map(id => {
return contracts[id]
})
console.log(myContracts)
</script>
<script id="jsbin-source-javascript" type="text/javascript">const contracts = {
111: {name: "contract111"},
222: {name: "contract222"},
333: {name: "contract333"},
444: {name: "contract444"},
}
const contractIds = [111, 333]
const myContracts = contractIds.map(id => {
return contracts[id]
})
console.log(myContracts)</script></body>
</html>
const contracts = {
111: {name: "contract111"},
222: {name: "contract222"},
333: {name: "contract333"},
444: {name: "contract444"},
}
const contractIds = [111, 333]
const myContracts = contractIds.map(id => {
return contracts[id]
})
console.log(myContracts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment