Created
August 4, 2016 02:18
-
-
Save anonymous/1fa11a7818dc692691c45346e1c1986b to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/wewafot
This file contains 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 charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<ul> | |
<li class="product">15.6</li> | |
<li class="product">6.2</li> | |
<li class="product">17.5</li> | |
<li class="product">45.0</li> | |
<li class="product">5.6</li> | |
<li class="product">9.0</li> | |
</ul> | |
<script id="jsbin-javascript"> | |
'use strict'; | |
var products = Array.from(document.querySelectorAll('.product')); | |
products.filter(function (product) { | |
return parseFloat(product.innerHTML) < 10; | |
}).forEach(function (product) { | |
return product.style.color = 'red'; | |
}); | |
console.log(products); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">const products = Array.from(document.querySelectorAll('.product')); | |
products | |
.filter(product => parseFloat(product.innerHTML) < 10) | |
.forEach(product => product.style.color = 'red'); | |
console.log(products);</script></body> | |
</html> |
This file contains 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
'use strict'; | |
var products = Array.from(document.querySelectorAll('.product')); | |
products.filter(function (product) { | |
return parseFloat(product.innerHTML) < 10; | |
}).forEach(function (product) { | |
return product.style.color = 'red'; | |
}); | |
console.log(products); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment