diff --git a/lib/browser/api/dialog.js b/lib/browser/api/dialog.js index 6669d8cab89a..3410618027fe 100644 --- a/lib/browser/api/dialog.js +++ b/lib/browser/api/dialog.js @@ -35,8 +35,9 @@ var parseArgs = function (window, options, callback, ...args) { } // Fallback to using very last argument as the callback function - if ((callback == null) && typeof args[args.length - 1] === 'function') { - callback = args[args.length - 1] + var lastArgument = args[args.length - 1] + if ((callback == null) && typeof lastArgument === 'function') { + callback = lastArgument } return [window, options, callback]