Загрузка...

JavaScript semicolon issue, find the output , #shorts #dailycoding #javascript #jobs #itjobs

JavaScript's automatic semicolon insertion inserts
a semicolon right after the return statement,
So it's undefined
Current code:
function foo() {
return; //l here semicolon automatically inserted
{
bar: "hello"
};
}

Correct way to write it:
To return the object correctly, put the opening
brace on the same line as return:
function foo() {
return {
bar: "hello"
}
}

so the answer will be undefined
#javascript #coading #findtheoutput #interviewquestions

Видео JavaScript semicolon issue, find the output , #shorts #dailycoding #javascript #jobs #itjobs канала Codelangs
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять