How is console.log() used to display variable values in the console?
A). By concatenating variables with strings.
B). By using special escape characters.
C). By including variables directly in the parentheses.
D). By using HTML tags.
What is the recommended approach for logging asynchronous operations using console.log()?
A). Use separate console.log() statements for each asynchronous operation.
B). Include all asynchronous logs within a single console.log() statement.
C). Disable logging for asynchronous operations.
D). Use console.error() for all asynchronous logs.
What happens if you include console.log() statements inside a loop with a large number of iterations?
A). It has no impact on script performance.
B). It significantly slows down script execution.
C). It optimizes loop execution for faster processing.
D). It automatically optimizes console logging for loops.
How does console.log() affect the performance of a webpage?
A). It improves page loading speed.
B). It has no impact on page performance.
C). It may slightly degrade performance if used excessively.
D). It optimizes JavaScript execution.
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 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.
How can you log formatted messages with variable values using console.log()?
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 is the behavior of console.log() when logging null or empty values?
A). It logs an empty string for null values and does not log empty values.
B). It logs 'null' or 'undefined' for null or empty values, respectively.
C). It ignores null or empty values and logs the rest of the message.
D). It displays an error message for null or empty values.
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 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.