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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s