Why is this code not working in Js

function greet(name, lastName) {

console.log('hello ' + 'name' + ' ' + 'lastName');
}
greet('qasem', 'nik');

someone tell me something

Your console.log statement concatenates the 4 strings 'hello ', 'name, ’ ’ and ‘lastName’. Instead, I assume you want to concatenate the string ‘hello’ with the value of the name variable and the ’ ’ and the value of the lastName variable.

Hint: Variables names will not have quotes around them.

1 Like

Hi @Qa3em, at the moment you are passing the hardcoded strings “name” and “lastName” in the console.log. You need to pass the paramaters name and lastName instead.

1 Like