This file contains hidden or 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
const elements = ["cat", "dog", "bat"] | |
_.every(elements, el => el.length == 3) | |
elements.every(el => el.length == 3) //true |
This file contains hidden or 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
_.each([1, 2, 3], (value, index) => { | |
console.log(value) | |
}) | |
[1, 2, 3].forEach((value, index) => { | |
console.log(value) | |
}) | |
_.forEach({ 'a': 1, 'b': 2 }, (value, key) => { | |
console.log(key); |
This file contains hidden or 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
const array = ['a', 'b', 'c'] | |
console.log(_.reverse(array)) // output: ['c', 'b', 'a'] | |
// Native | |
const array = ['a', 'b', 'c'] | |
array.reverse() | |
console.log(array) // output: ['c', 'b', 'a'] |
This file contains hidden or 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
const names = ["first", "middle", "last", "suffix"] | |
const firstName = _.first(names) | |
const otherNames = _.rest(names) | |
const [firstName, ...otherNames] = names | |
console.log(firstName) // 'first' | |
console.log(otherNames) // [ 'middle', 'last', 'suffix' ] |
This file contains hidden or 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
const numbers = [10, 40, 230, 15, 18, 51, 1221] | |
_.filter(numbers, num => num % 3 === 0) | |
numbers.filter(num => num % 3 === 0) |
This file contains hidden or 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
const users = [ | |
{ 'user': 'joey', 'age': 32 }, | |
{ 'user': 'ross', 'age': 41 }, | |
{ 'user': 'chandler', 'age': 39 } | |
] | |
// Native | |
users.find(function (o) { return o.age < 40; }) | |
//lodash |
This file contains hidden or 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
<blockquote> | |
There is <del>nothing</del> <ins>no code</ins> either good or bad, but <del>thinking</del> <ins>running it</ins> makes it so. | |
</blockquote> |
This file contains hidden or 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
<video controls> | |
<source src="https://addpipe.com/sample_vid/short.mp4" | |
poster="https://addpipe.com/sample_vid/poster.png"> | |
Sorry, your browser doesn't support embedded videos. | |
</video> |
This file contains hidden or 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
<label for="date">Enter date:</label> | |
<input type="date" id="date"/> | |
<label for="datetime">Enter date & time:</label> | |
<input type="datetime-local" id="datetime"/> | |
<label for="month">Enter month:</label> | |
<input type="month" id="month"/> | |
<label for="search">Search for:</label> |
This file contains hidden or 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
<label for="upload">Upload progress:</label> | |
<meter id="upload" name="upload" | |
min="0" max="100" | |
low="33" high="66" optimum="80" | |
value="50"> | |
at 50/100 | |
</meter> | |
<hr/> |