- Vue 3 composition api
- Javascript
- CSS modules
npm run dev
npm run build && npm run preview
-
Выполнится приведение типов к строке и конкатенация
console.log([1, 2, 3] + [4, 5, 6]) // '1,2,34,5,6'
-
Присваивание объектов происходит по ссылке. (в переменной
b
лежит ссылка на значениеa
)var a = { b: 1 } var b = a b.b = 2 console.log(a) // { b: 2 }
-
Не пропускает
00.1
,0.0.1
,0.1000
/(0|[1-9]\d*)([.,])([0-9]{1,3})/g
-
Строка проверяется на наличие:
https или http
и://
www.
- host'а
- path'а
- query
- anchor'а
/(https|http):\/\/(www\.)?([-a-zA-Z0-9]+\.)+([a-z]{2,6}(:\d+)?)(\/[a-zA-Z0-9]*)*(\?[a-zA-Z0-9@:%_+.~#?&/=-]*)?/g
-
Function и var имеют механизм hoisting'а, поэтому доступны до своего объявления
function setText(message) { text = message } var text = 'Текст' console.log(setText('Сообщение')) // 'Сообщение'
-
Возвращает массив артикулов строкового типа
/** @return {(string|null)[]} */ function getVendorList() { const productList = document.querySelectorAll('._product') return Array.from(productList).map((product) => product.dataset?.id ? `0${product.dataset.id}` : null) }
-
Возвращает объект с ключом и значением строкового типа
/** @return {Record<string, string>} */ function getProperties() { const properties = {} const namePropertyList = document.querySelectorAll('.parameter-name') const valuePropertyList = document.querySelectorAll('.parameter-name ~ .parameter-value') for (const [i, nameProperty] of namePropertyList.entries()) { properties[nameProperty.firstChild.textContent.trim()] = valuePropertyList[i].firstChild.textContent.trim() } return properties }