728x90 반응형 SMALL programming374 method) map() method 1. **Initialization of the Array**: An array named `numbers` is initialized with five integer values: 124, 235, 356, 546, and 23. 2. **Mapping to Square Values**: The `numbers` array is then transformed using the `map` function. For each element in the array, the function takes the element's value (`value`) and its index (`index`), squares the value (`value * value`), and returns this squared va.. 2025. 1. 17. method) Math.random() method ### Generating a Base Random Number - `const num = Math.random()` generates a base random floating-point number between 0 (inclusive) and 1 (exclusive). ### Scaling the Random Number - The script first demonstrates how to scale this base number to different ranges: - Multiplying `num` by 10 to get a range of 0 to just under 10. - Multiplying `num` by 50 to get a range of 0 to just under 50. ### .. 2025. 1. 16. method) prototype method ### Extending `Number.prototype` - A method `power` is added to `Number.prototype`, enabling any number to calculate its power. By default, it calculates the square (`n=2`), but it can take any exponent `n`. - Examples provided (`a.power()`, `a.power(3)`, `a.power(4)`) show using this method to compute the square, cube, and fourth power of a number `12`. ### Extending `String.prototype` and `Arr.. 2025. 1. 15. method) querySelector() ### HTML Structure - The body of the document contains an empty `` element. This is the target for the JavaScript code. ### JavaScript Functionality - An event listener is added to the `document` object for the `'DOMContentLoaded'` event. This ensures that the JavaScript code inside the callback function will only run after the initial HTML document has been completely loaded and parsed. - Insid.. 2025. 1. 14. 이전 1 ··· 3 4 5 6 7 8 9 ··· 94 다음 728x90 반응형 LIST