Month: August 2015

Check javascript object is function or not using Angular js

Hi Friends,

In the below post we learn how we can check whether a javascript object is function or not using Angular js. Angular js provide a function “angular.isFunction” to check whether a javascript object is function or not.

below is a sample code I have written

<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><!DOCTYPE html>
<html>
<head>
<script src="js/angular.js"></script>

<script type ="text/javascript">
function checkValue() {
}

var a = 10;

console.log(angular.isFunction(checkValue));
console.log(angular.isFunction(a));

</script>
</head>
<body>

</body>
</html>

In the above code I have defined a function “checkvalue” and a variable “a”. Next I am checking it using angular.isFunction method.

The output is as below.

image

I hope you found this post useful , Thanks for reading. Happy Coding. Smile