Question:
Write a function log, that takes a parameter and logs this parameter.
Example: log('Ken Thompson') should log 'Ken Thompson'.
Answer:
function log (param) {
console.log (param)
};
> This is a function declaration & not a function expression
> name of the function: log
> parameter: () parameter param
> statement: console.log (param), enclosed in curly brackets
> this function has console.log() to return the function in the console
> console.log method is used to display Javascript values in the browser
> console.log is a function in Javascript
> usually console.log is used for debugging purposes
> in this case the function log, when called, returns / logs the value of the parameter in the console
No comments:
Post a Comment