This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function rqGrid($window, rqUrl, columns, module, settings) { | |
| function rqGridLink(scope, $element) { | |
| var itemIdColumnName = columns.getItemIdDataField(); | |
| var jqx = new JqxGridInterface($element); | |
| if (settings) { | |
| jqx.call('loadState', settings); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.service('myService', function() { | |
| // service is just a constructor function | |
| // that will be called with 'new' | |
| this.sayHello = function(name) { | |
| return "Hi " + name + "!"; | |
| }; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function returnMe() { | |
| return arguments.callee; | |
| } | |
| console.log(returnMe()); //=> returnMe() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function takesVariableArgsWithOptionalHash() { | |
| var options = {}; | |
| var otherArgs = arguments; | |
| // steal slice from Array.prototype | |
| var slice = Array.prototype.slice; | |
| if (typeof arguments[arguments.length-1] == 'object') { | |
| options = arguments[arguments.length-1]; | |
| otherArgs = slice.call(arguments, 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // add up all the arguments sent to the function | |
| // no matter how many there are | |
| function sum() { | |
| var total = 0; | |
| for (var i = 0, l = arguments.length; i < l; i++) | |
| total += arguments[i]; | |
| return total; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Element() { | |
| if (this == window || 'Element' in this) { | |
| // the function is being called normally | |
| } | |
| else { | |
| // the function is being called via new | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var myObj = {}; | |
| for (var i = 0; i < 5; i++) { | |
| myObj['prop_' + i] = i; | |
| } | |
| myObj.prop_2 //=> 2 |