Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
programmieren:javascript:js_function_exists [2021/03/16 09:02] jgehrkeprogrammieren:javascript:js_function_exists [2022/12/17 12:28] – external edit 127.0.0.1
Line 23: Line 23:
 </code> </code>
  
-Verändert nach folgender Quelle: [[https://stackoverflow.com/questions/1042138/how-to-check-if-function-exists-in-javascript|Stackoverflow Beitrag(1)]], [[https://stackoverflow.com/questions/8592047/check-if-a-function-exists-with-its-name-in-a-string|Stackoverflow Beitrag(2)]] und [[https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/includes|MDN » array.includes()]]+Verändert nach folgender Quelle: [[https://stackoverflow.com/questions/1042138/how-to-check-if-function-exists-in-javascript|Stackoverflow Beitrag (1)]], [[https://stackoverflow.com/questions/8592047/check-if-a-function-exists-with-its-name-in-a-string|Stackoverflow Beitrag (2)]] und [[https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/includes|MDN » array.includes()]]
  
 +**Alternative wie es underscore.js macht**
 +Dieser Code ist auch gut, hat jedoch den Nachteil, das ''obj'' existieren muss, ansonsten gibt es einen Fehler.
 +
 +<code javascript>
 +is_function = function( obj ) {
 +  return !!(obj && obj.constructor && obj.call && obj.apply);
 +};
 +</code>
 +
 +Quelle: [[https://stackoverflow.com/questions/5999998/check-if-a-variable-is-of-function-type|Stackoverflow Beitrag (3)]]

Page Tools