Skip to content

Instantly share code, notes, and snippets.

<div class="images-container">
<div class="image-slider">
</div>
</div>
<div class="button-container">
<div class="button previous">&lt;&lt;</div>
<div class="button play">&#9654
</div>
<div class="button stop">&#9608</div>
<select class="dice-sides-input">
<option></option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>22</option>
</select>
.player-button {
height: 80px;
width: 200px;
border-radius: 4px;
border: 1px solid $black;
display: inline-block;
line-height: 80px;
}
.player-selector {
<html>
<head>
<title></title>
</head>
<body>
<div class="target"></div> <!-- new, empty div in body of html doc to append our newly fetched data to -->
<script type="text/template" class="api-request"> <!-- script/template created in your html doc. -->
items.forEach(function (item) {
if (item.price < 50) {
$('.main-container').append('<div class="container"></div>')
$('.container').last().append('<div class="box1" style="background-image: url(' + item.Images[0].url_170x135 + ')">', '<div class="box2">' + item.price + '</div>');
}
})
// Using the same data from Mason's bonus HW: https://gist.github.com/masondesu/1eafc9e7dff1ca7666ba
// the following will still return an array like the following:
[Array[2], Array[2], undefined, undefined, Array[2], Array[2], undefined, undefined, undefined, Array[1], undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, Array[1], undefined, undefined, undefined, undefined, undefined]
var styleZ = items.map (function (item) {
if (item.style != null) {
return item.style
}
})
var averagePrice = items.reduce(function (arrayZero, arrayOne) {
return {price: arrayZero.price + arrayOne.price};
})
averagePrice.price = +(averagePrice.price/items.length).toFixed(2);
// averagePrice.price = +(averagePrice.price).toFixed(2);
console.log("The average price is $", averagePrice.price);
items.forEach(function (array) {
var averagePrice = items.reduce(function (arrayZero, arrayOne) {
console.log((arrayZero.price + arrayOne.price)/items.length);
return {price: arrayZero.price + arrayOne.price};
})
averagePrice.price = +(averagePrice.price/items.length).toFixed(2);
// averagePrice.price = +(averagePrice.price).toFixed(2);
console.log("The average price is $", averagePrice.price);
.sonic{
width:5em;
height:5em;
background:#5B5BD9;
transition:all 0.6s ease;
}
.speedy {
height: 30em;