-3

In this code eval function is used: code1

function in string has 3 params, but eval runs function with 2 params:

code2

Why ?

3
  • 2
    Please don't use images of code, instead copy/paste the text of the code into the body of your question. Commented Aug 22, 2018 at 19:47
  • 3
    You've defined openURL twice. The second one ends up being the only one that's accessible Commented Aug 22, 2018 at 19:49
  • 5
    There is no function overloading in javascript. The second function overwrites the first, so you end up with only one openURL function that takes two parameters. Commented Aug 22, 2018 at 19:50

1 Answer 1

6

You cannot have 2 functions with the same name in the same scope.

There is no function overloading in javascript. (thanks ibrahim mahrir).

Delete the openURL function that starts on line 5317.

2019 Edit: It is possible to call different methods based on the number of arguments: pattern: https://johnresig.com/apps/learn/#90

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.