Question

I am working on the following code, and some sort of error is being found on the adding of 3 key-value pairs in the myData object:

var myArray = ["Francisco Souza Homem de Mello","franciscomello"];

var namer = myArray[0];

function cutName(namer) {

  return namer.split(" ");
}

var boxy = cutName(namer);

var myData = {
  fullname: cutName(namer),
  skype: myArray[1],
  github: "franciscomello"
};

The error is probaly on calling the cutName function on the myData object, but I cannot seem to find how to call it.

No correct solution

OTHER TIPS

fullname: cutName(namer) is not correct. you are expecting fullname to be a function but cutName(namer) is the return value of cutName() with param namer.
fullname: cutName or fullname: function () { cutName(namer) } should work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top