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
// Data array | |
const data = [{key: 'value 1'}, {key: 'value 1'}, {key: 'value 2'}, {key: 'value 3'}] | |
// Extended version | |
// 1. get all values | |
// 2. create a new Set and get unique values | |
// 3. create a new array and add a new value | |
const values = data.map(value => value.key) // ['value 1', 'value 1', 'value 2', 'value 3'] | |
const uniqueValues = new Set(values) // {'value 1', 'value 2', 'value 3'} | |
const newUniqueValues = [...uniqueValues, 'value 4'] // ['value 1', 'value 2', 'value 3', 'value 4'] | |
// Short Version (all-in-one) |
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> | |
<title>Responsive image full markup example</title> | |
<!-- | |
Don't preload if <picture> is used | |
@https://web.dev/preload-responsive-images/#preload-and-lesspicturegreater | |
--> | |
<link rel="preload" href="image_landscape.jpg" imgsrcset="image_landscape.jpg 1x, image_landscape@2x.jpg 2x" as="image"> | |
</head> |
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
// Get today date value | |
const today = new Date() | |
console.log(today) // Wed Feb 08 2023 23:26:49 GMT+0100 (Ora standard dell’Europa centrale) | |
// Italian date format | |
const localeIT = "it-IT" | |
const optionsIT = { weekday:"long", year: "numeric", month: "long", day: "numeric" } | |
// English / GB date format | |
const localeGB = "en-GB" |
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
<html> | |
<head> | |
<title>Skip links</title> | |
</head> | |
<style> | |
.skip-link{ | |
position: absolute; | |
z-index: 99; | |
left: -50%; | |
right: -50% |