0

So probably a silly question. How does this function know to replace "obj" with whatever object I put in, and replace "checkProp" with whatever property I put in? I'm pretty much just starting and feel like I may have missed something or just forgot. Thanks in advance!

function checkObj(obj, checkProp) {
  if (obj.hasOwnProperty(checkProp)) {
    return obj[checkProp];
  }
  else {
    return "Not Found";
  }
  return "Change Me!";
}
  • https://developer.mozilla.org/en-US/docs/Glossary/Parameter#:~:text=Function%20parameters%20are%20the%20names,values%20of%20the%20arguments%20supplied. – Sarah Oct 18 '22 at 22:50
  • Function parameters are like variables that get assigned the corresponding arguments’ values when the function is called. That’s a fundamental part to how functions work. – Sebastian Simon Oct 18 '22 at 22:52
  • https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments – Haim Abeles Oct 18 '22 at 22:52
  • Thanks y'all are awesome! – Zachary Adams Oct 18 '22 at 23:13
  • Does this answer your question? [What's the difference between an argument and a parameter?](https://stackoverflow.com/questions/156767/whats-the-difference-between-an-argument-and-a-parameter) – pilchard Oct 18 '22 at 23:13
  • This article will assist -> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions – dale landry Oct 18 '22 at 23:35

0 Answers0