A developer is asked to write a log containing the ID and name of the product with a variable named myProduct.
Which snippet of code should be used?
To log both the product ID and name, the correct code snippet should use string concatenation or template literals. The proper syntax is:
var log = Logger.getLogger('products', 'export');
log.info('Product ID: ' + myProduct.ID + ', Product Name: ' + myProduct.name);
Or using template literals:
log.info(`Product ID: ${myProduct.ID}, Product Name: ${myProduct.name}`);
This ensures both the ID and name are captured in the log message.
