728x90 반응형 SMALL programming375 chapter 5) expansion operator ### Default Parameters in Functions The `earnings` function calculates and logs an employee's earnings information. It takes three parameters: `name`, `wage`, and `hours`. The latter two have default values of `8590` (interpreted as hourly wage in won) and `40` (hours worked), respectively. - **First Call**: `earnings('cloud')` only specifies the `name` parameter. Since `wage` and `hours` are no.. 2024. 12. 9. chapter 5) fix name conflict issue ### Variable Scoping Demonstrated - **Global Scope**: Initially, a variable `pi` is declared with the value `3.14`. This variable has a global scope, meaning it can be accessed anywhere in the script. - **Block Scope**: The script then enters a block (denoted by curly braces `{}`). Inside this block, another `pi` variable is declared with the value `3.141592`. This declaration of `pi` is separat.. 2024. 12. 8. chapter 5) function_type ### Anonymous Function - **Anonymous Function**: Assigned to `const func`. Anonymous functions are functions without a name. This function logs several messages to the console when called. - `func()` is called twice, demonstrating that the function can be invoked like any named function. - `typeof func` shows that `func` is a function, and `console.log(func)` prints the function's definition to .. 2024. 12. 7. chapter 5) strict mode ### Strict Mode Activation - `'use strict'` at the beginning of the `` tag activates strict mode for the script. In strict mode, JavaScript will throw more exceptions and prevent or throw errors for actions that are considered to be bad practices or common mistakes. This includes, but is not limited to, preventing the use of undeclared variables. ### Commented Out Error - `//error -> data = 10` .. 2024. 12. 6. 이전 1 ··· 13 14 15 16 17 18 19 ··· 94 다음 728x90 반응형 LIST