VH
Size: a a a
VH
Н
d
A
d
A
d
E
С
A
VY
function isset(val) {проверяет существование константы, если ее нет - создает.
return typeof val !== 'undefined';
}
if (!isset(hiddenFields)) {
const hiddenFields = document.querySelector("#hiddenFields");
}
if (!isset(updatePromo)) {
const updatePromo = document.querySelector("#updatePromo");
}
if (!isset(showSubId)) {
const showSubId = document.querySelector("#showSubId");
}
if (!isset(setChange)) {
const setChange = document.querySelector("#promo_id_change");
}
if (!isset(setChange)) {вызывает ошибку.
const setChange = document.querySelector("#promo_id_change");
}
Uncaught ReferenceError: setChange is not defined
A
A
A
VY
d
VY
VY
isset
- вместо typeof val !== 'undefined'
A
u
function isset(val) {проверяет существование константы, если ее нет - создает.
return typeof val !== 'undefined';
}
if (!isset(hiddenFields)) {
const hiddenFields = document.querySelector("#hiddenFields");
}
if (!isset(updatePromo)) {
const updatePromo = document.querySelector("#updatePromo");
}
if (!isset(showSubId)) {
const showSubId = document.querySelector("#showSubId");
}
if (!isset(setChange)) {
const setChange = document.querySelector("#promo_id_change");
}
if (!isset(setChange)) {вызывает ошибку.
const setChange = document.querySelector("#promo_id_change");
}
Uncaught ReferenceError: setChange is not defined