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 definedA
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