Start learning 50% faster. Sign in now
Default parameters in ES6 enable a function to use a default value for a parameter if no argument is passed. This enhances code readability and reduces the need for conditional checks. Example: function greet(name = "Guest") { return `Hello, ${name}!`; } console.log(greet()); // Outputs: Hello, Guest! console.log(greet("Alice")); // Outputs: Hello, Alice! This feature is especially useful in scenarios where optional parameters are involved, as it simplifies function declarations. ________________________________________ Why Other Options Are Incorrect: 1. Arrow functions: Arrow functions are a concise syntax for writing functions but do not relate to parameter defaults. 2. Template literals: Template literals allow embedding expressions in strings using backticks, unrelated to parameter handling. 3. Rest parameters: Rest parameters gather multiple arguments into an array, enabling flexible argument handling but do not assign defaults. 4. Destructuring assignment: Destructuring allows unpacking values from arrays or objects but does not deal with function defaults.
जिसमें चेतना न हो ' वाक्यांश के लिए निम्नलिखित में से क�...
वर्तनी की दृष्टि से निम्नलिखित में कौन - सा शब्द अशुद्�...
दो शब्दों , वाक्यांशों या वाक्यों को परस्पर जोडनेवाले , अ�...
--- में से कौन मूर्द्धन्य ध्वनि नहीं है
‘सृष्टि’ का विलोम है
’ स्याह’ किसका पर्यायवाची है?
CONVENE’ के लिए हिन्दी पारिभाषिक शब्द है
शुद्ध वर्तनी वाला शब्द है
जिससे बढ़कर ऊँचा कोई न हो' के लिए निम्नलिखित में से कौन�...
कार्यालयी पत्र-लेखन में संबोधन के लिए प्रयुक्त किया जाने �...