A short list
Facts, sourced
- HTML
- HTML (HyperText Markup Language) is the most basic building block of the Web: it defines the meaning and structure of web content. MDN: HTML HTML uses markup to annotate text, images and other content for display in a web browser, and elements are marked off with tags. MDN: HTML
- CSS and JavaScript beside it
- Besides HTML, other technologies are generally used to describe a web page's appearance (CSS) or its behaviour (JavaScript). MDN: HTML CSS is a language of style rules used to style HTML content, for example background colours, fonts, and laying content out in more than one column. MDN: What is JavaScript?
- What JavaScript is
- JavaScript is a scripting or programming language that lets you add complex features to web pages, rather than leaving a page as static information to look at. MDN: What is JavaScript? MDN calls JavaScript the third layer of the "layer cake" of standard web technologies, after HTML and CSS. MDN: What is JavaScript?
- Where the code runs
- Client-side code runs on the visitor's computer: when a web page is viewed, that code is downloaded, then run and displayed by the browser. MDN: What is JavaScript? When you load a web page, the HTML, CSS and JavaScript run inside an execution environment, the browser tab. MDN: What is JavaScript?
- Java is a different language
- JavaScript should not be confused with the Java programming language: the two are significantly different in syntax, semantics and use. MDN Glossary: JavaScript
- Array.sort()
- Array.prototype.sort() sorts an array in place. The default order is ascending, built by converting the elements to strings and then comparing their UTF-16 code unit values. MDN: Array.sort() MDN's own example shows that [1, 30, 4, 21, 100000].sort(), with no compare function, comes out as [1, 100000, 21, 30, 4], not numeric order. MDN: Array.sort()
- map and parseInt
- A common confusion: ["1", "2", "3"].map(parseInt) does not give [1, 2, 3]. The actual result is [1, NaN, NaN]. MDN: Array.map()
- innerHTML and textContent
- When you know the visitor-provided content should be plain text, MDN says Node.textContent should be used. That prevents the string being parsed as HTML. MDN: Element.innerHTML MDN advises against using innerHTML to get or set text inside an element, because it deals with raw HTML rather than plain text and can be susceptible to XSS attacks, even if you are sure the text never contains HTML syntax. MDN: Node.textContent
The whole story, sourced: https://ai.programmers.im/.