-1
function sayHello (userName)  {
    console.log ('Hello ${userName}') ;
}

sayHello ('Mena') ;

function sayHello (userName)  {
    console.log ('Hello ${userName}') ;
}

sayHello ('mena') ;

// i expected to show say ( Hello Mena ) in the console //

2

1 Answer 1

0

You need to use backticks(`) instead of (').

Example:

function sayHello (userName) {
    console.log (`Hello ${userName}`);
}
Sign up to request clarification or add additional context in comments.

1 Comment

@Sauabh Be aware of the formating! Backticks have a meaning in markdown text and isn't shown verbatim. You need it in a code segment, that can be solved by adding 4 spaces at the beginning of each line. Check the preview before publishing.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.