var arr = [
{ name: "height", value:"20" },
{ name: "width", value:"30" }
]
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 http-equiv="X-UA-Compatible" content="IE=edge;" /> | |
<title>Vital Records Produce Copy has Moved! | VDH</title> | |
<link rel="icon" type="image/x-icon" href="data:image/png;base64,AAABAAEAQEAAAAEAGAAoMgAAFgAAACgAAABAAAAAgAAAAAEAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAChcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQG |
There's a pretty standard way to manipulate an array and return the slightly transformed contents using .map()
, but there's a lot of options when it comes to objects, opening the door to potential confusion. Here's an approach to looping through an object in JS
Let's start with the following object:
let authors = {
"Kyle": {"description": "Likes Cats"},
"Brian": {"description": "Automation champion"},
"Sandra": {"description": "Swiss army knife"}
}
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
let gifts = ["partridge in a pear tree", "turtle doves", "French hens", "calling birds", "gold rings", "geese a-laying", "swans a-swimming", "maids a-milking", "ladies dancing", "lords a-leaping", "pipers piping", "drummers drumming"] | |
let numLookup = [ | |
{ cardinal: "a", ordinal: "first" }, | |
{ cardinal: "two", ordinal: "second" }, | |
{ cardinal: "three", ordinal: "third" }, | |
{ cardinal: "four", ordinal: "fourth" }, | |
{ cardinal: "five", ordinal: "fifth" }, | |
{ cardinal: "six", ordinal: "sixth" }, | |
{ cardinal: "seven", ordinal: "seventh" }, |
Here's an example of two strings to run through a diffing processes
let oldText = "start case old Text"
let newText = "start Case next Text"
These get tokenized by each word (separated by a space) and passed into difflib which produces the following result:
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
module.exports = function(eleventyConfig) { | |
eleventyConfig.addShortcode("year", () => new Date().getFullYear()); | |
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.