how to check calling function in jquery [duplicate] - javascript

This question already has answers here:
How do you find out the caller function in JavaScript?
(36 answers)
Closed 9 years ago.
I have a common error function which is called from many places. I want to know from which function this was called. Is there any way to do it?

In any javascript function you can use
arguments.callee.caller

if You want to execute JS in chrome you have to do like this
go to console and type your JS and enter!

Related

Is it possible to execute the value of an HTML textbox? [duplicate]

This question already has answers here:
How to pass text in a textbox to JavaScript function?
(7 answers)
Closed 2 years ago.
I'm trying to create something that allows people to execute a line of JS. I want to convert the string that people type into a function to execute on the page using the HTML tag
I've looked around and nothing is helping to this.
you can use eval();
example :
eval("console.log('hello')");

How to add a pause in JavaScript? [duplicate]

This question already has answers here:
What is the JavaScript version of sleep()?
(91 answers)
Closed 2 years ago.
I've looked everywhere and can't find a solution. I'm using the console part of developer tools on chrome if that helps :)
I've tried various configurations such as the example below, and all give me an error
setTimeout(s)5
I'm not sure exactly what you are trying to do, but I think you need to pass a function and the length of timeout into the setTimeout method like this example
setTimeout(function(){ alert("Hello"); }, 3000);

Jquery.clean method documented? [duplicate]

This question already has answers here:
What is the purpose of jQuery clean and cleanData methods?
(2 answers)
Closed 8 years ago.
I have to update some code using jquery and I have the following statements :
$.each($.clean({0:data}, this.ownerDocument), fct);
Where data is html content from server.
I didn't find any documentation about this method.
I just know that Jquery 1.9 remove it
Those methods are not meant to be used outside of jQuery, that's why you are having so much trouble finding documentation on them.

Javascript function compiling? [duplicate]

This question already has answers here:
Why can I use a function before it's defined in JavaScript?
(7 answers)
Closed 10 years ago.
I have noticed that when coding in javascript, it doesn't matter if i declare the function before or after i call it. In other languages it will cause an exception, but when running javascript in chrome it works just fine. Is that only in chrome, or is that normal?
What you're seeing is function hoisting in action: http://elegantcode.com/2011/03/24/basic-javascript-part-12-function-hoisting

Is there a difference between (function(){})(); and (function(){}()); [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
JavaScript: immediate function invocation syntax
A similar question has been asked here
there, the author asked about the difference between
(function(){})();
and
function(){}();
the purpose of the first is, among other things, to inform the reader that the function is to be immediately executed. I have also seen this version
(function(){}());
Is this the same as the above two?
This variant function(){}(); will give you syntax error

Categories

Resources