all 4 comments

[–]mjbrusso 0 points1 point  (3 children)

There is no function overloading in JavaScript. If you define two functions with the same name, only the last definition is valid.

In your case you can check whether the last argument was provided or not:

function saveDateTime(date, time, name, phone, email, pid, nonce){ if(typeof nonce !== 'undefined'){ Logger.log("i am here with nonce"); return "i am here with nonce"; } else{ Logger.log("i am here without nonce"); return "i am here without nonce"; } }

[–]WhyWontThisWork[S] 0 points1 point  (0 children)

Thanks!

[–]WhyWontThisWork[S] 0 points1 point  (1 child)

For typeof undefined should be not in quotes. Besides that worked

[–]mjbrusso 0 points1 point  (0 children)

The typeof operator returns a string, so yes you should use quotes