Skip to content

Instantly share code, notes, and snippets.

$(document).ready(function() {
// Array to store all feed sources
//all caps b/c it's a const
var SOURCES = [{
displayName: "Reddit",
url: "https://www.reddit.com/r/worldnews/top/.json",
proxyRequired: false,
defaultSource: true, // You can have only one default source
formatResponse: function(response) {
var items = response.data.children;
//we create an object called _
var _ = {
//the first property is called map it's a method that takes two arguments
//the first argument is list, the second is a call back function
map: function(list, cbFn) {
//this funciton creates a new array
var newArray = [];
//it uses a forEach loop to go through list returning the element i'm not sure what index is doing?
list.forEach(function(elem, index) {
// curious what this is doing? https://learn.jquery.com/using-jquery-core/document-ready/
//bn notes: kind of a mess, lots of notes by myself you can ignore, couldn't get focus to work??? :/
$(document).ready(function() {
// write your code here
/*You should be working in `app.js` in `homeworks/homework-02/js`. I commented out the
predefined list items in index.html because the todolist is empty when
the page starts. You need to use those list items as a reference for
the html that's to be inserted onto the page.
*/
var numPricesArray = [];
var prices = ['100', '125', '129', '37', '38', '75', '87', '94', '300', '301',
'305', '50', '0.30', '0.01', '0.5', '5', '15', '24', '35', '1041', '1', '17',
'21', '28', '97', '6', '10', '49', '65', '89', '6', '10', '49', '65', '89'];
prices.forEach(function(num){
var newOne = parseFloat(num);
numPricesArray.push(newOne);