OcttKB Cross-Repo Sync (HTML to Raw)

This commit is contained in:
2023-12-24 00:23:45 +00:00
parent afab887b00
commit 7eb1abe395
28 changed files with 127 additions and 30 deletions

View File

@ -1,6 +1,6 @@
created: 20221110145611678
creator: Octt
modified: 20231222115353008
modified: 20231223224154890
modifier: Octt
tags: Development $:/i18n:en Web
title: JavaScript
@ -31,6 +31,7 @@ title: JavaScript
* [[Fastest method to escape HTML tags as HTML entities?|https://stackoverflow.com/questions/5499078/fastest-method-to-escape-html-tags-as-html-entities]] --- in the browser, `(html) => { var escape = document.createElement('textarea'); escape.textContent = html; return escape.innerHTML; }`
* [[Get a random item from a JavaScript array|https://stackoverflow.com/questions/5915096/get-a-random-item-from-a-javascript-array#5915122]] --- `item = items[Math.floor(Math.random() * items.length)];`
* [[Simplest code for array intersection in javascript|https://stackoverflow.com/questions/1885557/simplest-code-for-array-intersection-in-javascript#1885569]] --- `arrayNew = array1.filter(value => array2.includes(value));`
* [[Why is 'for (... in ...)' with arrays considered bad practice in JavaScript?|https://stackoverflow.com/questions/2265167/why-is-forvar-item-in-list-with-arrays-considered-bad-practice-in-javascript]] --- use `for (... of ...)` instead
* [[How to get text from all descendents of an element (disregarding scripts)?|https://stackoverflow.com/questions/2532043/how-to-get-text-from-all-descendents-of-an-element-disregarding-scripts]]
* [[Converting HTML string into DOM elements?|https://stackoverflow.com/questions/3103962/converting-html-string-into-dom-elements#3104237]] --- `doc = new DOMParser().parseFromString(htmlString, 'text/html')`