I need some Java Script help

I need some Java Script help
0

#1

This below is my problem i am having it is split into three sections what am i doing wrong.

//Create a function called myName that returns your name

function myName(){
return prompt(‘Brendan’)

//Now save the function definition of myName into a new variable called newMyName

var newMyName=(‘myName’)

//Now alert the result of invoking newMyName

alert(‘newMyName’)
}


#2

Please take a look http://www.w3schools.com/jsref/met_win_prompt.asp

And then try to solve the problem. If you can’t, https://jsfiddle.net/hisener/8737pn5j/


#3

Check if the brackets match. Use the Developer tools of your browser to execute line by line when it is possible or some equivalent action. Try to learn exactly how things work --in this case, the prompt method, reading the documentation. Try the ww3schools as advised in the former answer.


#4

Remember, if you enclose something in quotation marks (single or double) it becomes a string.

Take the following example:

var myVar = "pizza";
 console.log(myVar);// logs "pizza"
 console.log('myVar'); // logs 'myVar'. Not what I want!

Same with functions that return a string:

function myFunc(){
 return "foo";
}

console.log(myFunc()); // logs "foo"
console.log("myFunc()"); // logs "MyFunc()" Not what I want!

Hope this helps!