JS_HOME_WORK/68-presence-of-the-function-parameters/finish.js
2025-02-05 08:47:22 +01:00

18 lines
584 B
JavaScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/** ЗАДАЧА 68 - Проверка наличия аргументов в вызове функции
*
* Измените функцию "square" так, чтобы в случае ее вызова
* без аргумента генерировалась ошибка
* "Функция "square" не может быть вызвана без аргумента"
*/
function square(a) {
console.log(a * a)
}
square(10)
// 100
square()
// ДО: NaN
// ПОСЛЕ: Uncaught Error: Функция "square" не может быть вызвана без аргумента