angular-isArray-4

 
In this example, there are two variable one contains string value and another is an array and it checks both of them and display the output in result window. See the code snippet:
 
 
 
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Welcome in the AngularJS</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app="app"> <div ng-controller="isArrayController as vm"> isArray1: {{vm.isArray1}}<br /> isArray2: {{vm.isArray2}} </div> </body> </html> <script> var app = angular.module("app", []); app.controller('isArrayController', [function () { var vm = this; var arrs = [1, 2, 3, 4, 5, 6]; var str = "www.learnkode.com"; vm.isArray1 = angular.isArray(arrs); vm.isArray2 = angular.isArray(str); }]); </script>
Output