javascript: Rozdiel medzi revíziami
Skočit na navigaci
Skočit na vyhledávání
(Vytvorená stránka „{{DISPLAYTITLE:JavaScript}} const myConst = ...; let myVar = ...; == Array == [1, 2, 3] Array(myLength.fill(myValue) // tá istá hodnota Array.f…“) |
|||
Riadok 1: | Riadok 1: | ||
{{DISPLAYTITLE:JavaScript}} | {{DISPLAYTITLE:JavaScript}} | ||
+ | |||
+ | false | ||
const myConst = ...; | const myConst = ...; | ||
let myVar = ...; | let myVar = ...; | ||
+ | |||
+ | arguments | ||
+ | |||
+ | Math.floor(...) | ||
+ | Math.random() | ||
+ | |||
+ | `${myVar}` | ||
+ | myString.startsWith('abc') | ||
+ | myArray.join(',') | ||
== Array == | == Array == | ||
Riadok 8: | Riadok 19: | ||
[1, 2, 3] | [1, 2, 3] | ||
Array(myLength.fill(myValue) // tá istá hodnota | Array(myLength.fill(myValue) // tá istá hodnota | ||
− | Array.from(myArray) | + | Array.from(myArray) // skopíruje hodnoty |
− | Array.from('abc') | + | Array.from('abc') // ['a', 'b', 'c'] |
− | Array.from(mySet) | + | Array.from(mySet) |
− | Array.from(myMap) | + | Array.from(myMap) // [[k1, v1], [k2, v2]] |
− | Array.from(myArray, (oldValue, index) => ...) | + | Array.from(myArray, (oldValue, index) => ...) // upraví hodnoty |
− | Array.from({length: myLength}, (_, index) => ...) | + | Array.from({length: myLength}, (_, index) => ...) // vygeneruje hodnoty |
+ | myArray.push(...) | ||
+ | myArray.forEach(item => ...) | ||
+ | myArray.forEach((item, index) => ...) | ||
+ | myArray.slice() | ||
+ | myArray.slice(start, end) | ||
+ | |||
+ | == Set == | ||
+ | |||
+ | new Set() | ||
+ | mySet.size | ||
+ | mySet.add(...) | ||
== Map == | == Map == | ||
− | myMap.keys() | + | myMap.keys() |
− | myMap.values() | + | myMap.values() |
+ | myMap.has(k) | ||
+ | myMap.get(k) | ||
+ | myMap.set(k, v) | ||
== DOM == | == DOM == | ||
− | document.getElementById('myId') | + | alert('...') |
+ | |||
+ | document.getElementById('myId') | ||
+ | document.querySelectorAll('img') | ||
+ | document.querySelectorAll('.myClass') | ||
+ | document.createElement('div') | ||
+ | |||
+ | myCanvas.getContext('2d') | ||
+ | myCanvas.getBoundingClientRect() | ||
+ | myContext.clearRect(x, y, w, h) | ||
+ | myContext.drawImage(image, x, y, w, h) | ||
+ | |||
+ | myImage.src | ||
+ | |||
+ | myButton.addEventListener('click', e => ...) | ||
+ | |||
+ | myClickEvent.clientX | ||
+ | myClickEvent.clientY | ||
+ | |||
+ | myRectangle.left | ||
+ | myRectangle.top | ||
− | + | myElement.innerHTML | |
+ | myElement.textContent | ||
+ | myElement.classList | ||
+ | myElement.style | ||
+ | myElement.appendChild(...) |
Aktuálna revízia z 21:56, 12. október 2024
false
const myConst = ...; let myVar = ...;
arguments
Math.floor(...) Math.random()
`${myVar}` myString.startsWith('abc') myArray.join(',')
Array
[1, 2, 3] Array(myLength.fill(myValue) // tá istá hodnota Array.from(myArray) // skopíruje hodnoty Array.from('abc') // ['a', 'b', 'c'] Array.from(mySet) Array.from(myMap) // [[k1, v1], [k2, v2]] Array.from(myArray, (oldValue, index) => ...) // upraví hodnoty Array.from({length: myLength}, (_, index) => ...) // vygeneruje hodnoty myArray.push(...) myArray.forEach(item => ...) myArray.forEach((item, index) => ...) myArray.slice() myArray.slice(start, end)
Set
new Set() mySet.size mySet.add(...)
Map
myMap.keys() myMap.values() myMap.has(k) myMap.get(k) myMap.set(k, v)
DOM
alert('...')
document.getElementById('myId') document.querySelectorAll('img') document.querySelectorAll('.myClass') document.createElement('div')
myCanvas.getContext('2d') myCanvas.getBoundingClientRect() myContext.clearRect(x, y, w, h) myContext.drawImage(image, x, y, w, h)
myImage.src
myButton.addEventListener('click', e => ...)
myClickEvent.clientX myClickEvent.clientY
myRectangle.left myRectangle.top
myElement.innerHTML myElement.textContent myElement.classList myElement.style myElement.appendChild(...)