Sign in
Log inSign up

bitcoinData

miguelmanalo's photo
miguelmanalo
·Jun 4, 2020
//Number 1
// console.log(bitcoinData);
// console.log(bitcoinData[0]);
//array which entry has the date I want, 
// Number 2 
// function findObjectByKey(array, key, value) {
//     for (var i = 0; i < array.length; i++) {
//         if (array[i][key] === value) {
//             return array[i];
//         }
//     }
//     return null;
// }
// var obj = findObjectByKey(bitcoinData, 'date', '2013-05-01');
// console.log(obj);
//Number 3 
//only the date and price 
// const newArray = bitcoinData.map(function(obj) {
//   return ("This is the date: " + obj['date'] + " " + " " + "This is the price: " + obj["price(USD)"]);
// })
// console.log(newArray);
//Number 4 
// const exchangevolume = bitcoinData.filter(function(obj){
// return obj["exchangeVolume(USD)"]>0;
// })
// console.log(exchangevolume);
//Number 5
// let genSum = bitcoinData.reduce
// (function (acc, currValue) {
//   return acc + currValue["generatedCoins"]
// }, 0)
// console.log(genSum);
//Number 6
// const over100 = bitcoinData.filter(function(obj){
// return obj["price(USD)"]>100;
// })
// console.log(over100.length);
//Number 7 
let feesSum = bitcoinData.reduce
(function (acc, currValue) {
  return acc + currValue["fees"]
}, 0)
console.log(Math.floor(feesSum/bitcoinData.length));
//"fees"