Question: Take a moment to read through the code below. const locations = { } ; function createSecretLocation ( lat , lon, passcode ) { if

Take a moment to read through the code below.
const locations ={};
function createSecretLocation(lat, lon, passcode){
if (!lat ||!lon ||!passcode){
throw"latitude, longitude, and passcode are required!"; }
try { locations[lat][lon]= passcode; } catch (error){ locations[lat]={}; locations[lat][lon]= passcode; }
}
What will be the last line of code run in the createSecretLocation() function if the function is called as follows:
createSecretLocation(40.35,-105.81, "ROCKY-MOUNTAINS");
A) throw "latitude, longitude, and passcode are required!";
B) locations[lat][lon]= passcode; inside the try block.
C) locations[lat][lon]= passcode; inside the catch block.
D) None of the above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!