What is the primary purpose of console.log() in JavaScript?
A). To display messages on the webpage.
B). To log information to the browser's console.
C). To prompt user input.
D). To create interactive elements.
How does console.log() impact the accessibility of a webpage?
A). It improves accessibility by providing interactive elements.
B). It has no impact on accessibility.
C). It may negatively impact accessibility for users with disabilities.
D). It optimizes page performance for accessibility features.
How can you include JavaScript expressions in console.log() messages?
A). By enclosing expressions in backticks (`) within the message string.
B). By using special symbols like %s and %d.
C). By wrapping expressions in square brackets [].
D). By assigning expressions to separate log methods.
How can you format log messages using console.log() to include variable values or expressions?
A). By using special symbols like %s and %d in the message string.
B). By enclosing expressions in backticks (`) within the message.
C). By concatenating variables directly in the parentheses.
D). By assigning expressions to separate log methods.
What does console.log() output when logging an undefined variable?
A). An empty string.
B). 'undefined'
C). null
D). An error message.
Which approach is recommended for logging sensitive data using console.log()?
A). Use console.warn() instead of console.log().
B). Use console.log() with encryption algorithms.
C). Avoid logging sensitive data altogether.
D). Use console.error() instead of console.log().
How does console.log() handle logging objects with nested properties?
A). It prints only the top-level properties of the object.
B). It converts the object and all nested properties into string representations.
C). It displays an error message for objects with nested properties.
D). It ignores nested properties and logs the object structure only.
Which method can be used to log warning messages in JavaScript?
A). console.debug()
B). console.info()
C). console.warn()
D). console.error()
What is the recommended approach for handling console logs in production code?
A). Disable all console logs in production code.
B). Include detailed console logs for all scenarios.
C). Use conditional logging and minimize excessive logging.
D). Log all errors and exceptions using console.error().
What type of information can be logged using console.log() in JavaScript?
A). Only strings and text-based data.
B). Strings, numbers, objects, arrays, and other data types.
C). Numbers and mathematical calculations.
D). Images and multimedia content.