728x90 반응형 SMALL 전체 글367 function) prompt() 1. **`prompt('message', '_default')`**: This line displays a dialog box to the user with a text input field. - The first argument `'message'` is the text displayed in the dialog box as a message or question to the user. - The second argument `'_default'` specifies the default input value that appears in the text field. The user can either accept this default value, modify it, or enter a complete.. 2025. 1. 26. class) generate object 1. **`createsStudent` Function**: This function is crafted to generate an object for each student, provided with attributes for their name and scores across four subjects (Korean, English, Math, and Science). It returns an object containing: - The student's name and their subject scores as object properties. - A `getSum` method that computes the sum of scores across the four subjects. - A `getAv.. 2025. 1. 25. method) private ### Key Points of Each Class: - **Constructor**: Checks if the provided length is greater than 0. If it's not, an error is thrown, preventing the creation of a Square with a non-positive side length. - **`getPerimeter` Method**: Returns the perimeter of the square, calculated as four times the length of one side. - **`getArea` Method**: Returns the area of the square, calculated as the length of.. 2025. 1. 24. class) Ractangle class ### Basic Rectangle Class - **`Rectangle` class**: Defines a rectangle with width and height properties, methods to calculate perimeter (`getPerimeter`) and area (`getArea`). - **`rectangle` instance**: Demonstrates creating a `Rectangle` object with a width of 10 and height of 20, then logs its perimeter and area. ### Square Classes Demonstrating Different Approaches 1. **`Square` class (Direct.. 2025. 1. 23. 이전 1 2 3 4 5 ··· 92 다음 728x90 반응형 LIST