JS Assignment 8: Scope and the Return Statement
skudeva (8)

Hi everyone,

I just started learning JS so I am still pretty new at this. I've been struggling with the JS Assignment 8: Scope and the Return Statement (pre-course work) exercise #3. Please if anyone knows the answer explain how do I get it, that'd be highly appreciated!

// Exercise Three:
// Create a function called 'sayMyName'. It will take one parameter. Call this
// parameter 'myName'. Return the phrase "Hello, my name is " and the myName parameter.
// eg: if name is 'Dan' it should return the string: 'Hello, my name is Dan'.

let myName ="Dan";
function sayMyName(myName){
return "Hello, my name is"; 



Thank you!

You are viewing a single comment. View All
Answered by JustARatherRidi (187) [earned 5 cycles]
View Answer
JwalyaOza (3)

is there anyone who can help me or let me correct myself... can guide me in order to complete the js assignment 8 right from exercise 1 part a and b i really need some guidance to finish that assignment

Shif (1)


Sometimes the more direct answers can stump us!

In this case, we refer to the code already written for us which referenced the global var for school declared up top (outside the function)

let school = 'Lambda';

and the var is referenced inside the function:

function nameMySchool(){
  let className = "Web Development Fundamentals"

on line 7:


The instructions:

// Exercise One: 
// Part One: Create a variable called 'inFunction' and 
//           assign it to the value that will be logged
//           on line 7.

The solution:

let inFunction = "Lambda";
JwalyaOza (3)

@Shif . Thanks a lot ma'am now i got able to understand what exactly they were expecting me to do in this particular assignment. now i'll be able to finish it with ease thanks a lot for your guidance ma'am and if i'd get any kind of quarries in further assignments then i'll surely contact you and i hope you'll also help me... thanks a lot once again ma'am. it was pleasure.