Basic JavaScript - Using Objects for Lookups

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

// Setup
function phoneticLookup(val) {
  let result = "";

  // Only change code below this line
  var lookup={
    "alpha":"Adams",
    "bravo":"Boston",
    "charlie":"Chicago",
    "delta":"Denver",
    "echo":"Easy",
    "foxtrot":"Frank"
    
  }
  
  result = lookup[val];
  console.log(phoneticLookup('charlie'));

  // Only change code above this line
  return result;
}

phoneticLookup("charlie");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Using Objects for Lookups

Link to the challenge:

Hey guys was messing around with the console.log commands to see if i can find what happens when pointing at a certain variable.

If i use log to read phoneticLookup i get this error

RangeError: Maximum call stack size exceeded

I was trying to look up variables in the function to see if they match the intended string.

Like foxtrot should point to Frank and what not.

This usually means you are calling your function inside of your function forever

Delete your line: " console… "

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.