본문 바로가기
728x90
반응형
SMALL

programming375

chapter 6) check undefined type ### Conditional Checks for Property Existence - **First Check**: Determines if the `name` property exists in `object`. Since `object.name` is defined (`'python'`), it logs `'name tag'`. - **Second Check**: Checks if the `author` property exists. Since `object.author` is `undefined` (the property doesn't exist), it logs `'not author tag'`. ### Conditional Assignment - Attempts to assign values to.. 2024. 12. 13.
chapter 6) href of output script test.js console.log('test file') const sample = 10 ### Key Elements - **External JavaScript File**: The document includes a script file located at `'Output_Script/test.js'`. For this to work correctly, the path to `test.js` must be relative to the location of the HTML document, or an absolute path must be provided. This script is expected to define or do something that makes `sample` available t.. 2024. 12. 12.
chapter 6) method inside of this keyword ### Object Methods and `this` Keyword - **First Object (`pet`)**: - Defines an object `pet` with a property `name` and a method `eat`. The method is defined using a function expression. - When `eat` is invoked with `'rice'`, it alerts a message indicating what `pet` is eating. However, there's a minor typo in the string concatenation inside `alert`: spaces are missing around `'is'`. It should be.. 2024. 12. 11.
chapter 5) callback ### Declarative Function Example - **`callThreeTimes` Function**: This is a higher-order function because it takes another function as its argument (`callback`). It runs a loop three times, calling the `callback` function on each iteration with the current index `i` as its argument. - **`print` Function**: A simple function that logs the current iteration number to the console, appending "call o.. 2024. 12. 10.
728x90
반응형
LIST