Nodejs Array Convert toIntArray()

Here you can find the source of toIntArray()

Method Source Code

Array.prototype.toIntArray = function() {
    var int_array = [];
    for (var i=0; i < this.length; i++) {
        var val = parseInt(this[i], 2);
        int_array.push(val);/*  w w  w . ja v a  2s .c om*/
    }
    return int_array;
};

Related

  1. toForty()
    Array.prototype.toForty = function(){
      b = [];
      for(i=2; i<=40; i+=2){
        b.push(i);
      return b
    
  2. toForty()
    Array.prototype.toForty = function() {
      'use strict';
      var arr = [];
      for (var i = 2; i <= 40; i += 2) {
        arr.push(i);
      return arr;
    };
    
  3. toHash()
    Array.prototype.toHash = function(){
      var map = {}
      for(var i = 0;i < this.length; i++)
        map[this[i]] = ''
      return map
    };
    
  4. toHash()
    Array.prototype.toHash = function()
        var r = new Hashtable();
        this.forEach(function (item) { r.put(item, true); });
        return r;
    
  5. toHexArray()
    Array.prototype.toHexArray = function() {
        var hex_array = [];
        for (var i=0; i < this.length; i++) {
            var val;
            if (typeof(this[i]) === "string") {
                val = parseInt(this[i], 2).toString(16);
            else if (typeof(this[i]) === "number") {
                val = this[i].toString(16);
    ...
    
  6. toInts()
    Array.prototype.toInts = function(){
      return this.map(function(val){
        return parseInt(val, 10);
      });
    };
    
  7. toJSON()
    Array.prototype.toJSON = function(){
        var result = [];
        this.forEach(function(item,index){
            result.push( item.toJSON ? item.toJSON() : item );
        });
        return result;
    
  8. toJson()
    Array.prototype.toJson = function(){
      return JSON.stringify(this);
    };
    
  9. toList(separator, aggregator)
    Array.prototype.toList = function(separator, aggregator) {
      aggregator = aggregator || separator;
      return this.join(aggregator, [this.join(separator, this.slice(0, -1)), this.slice(-1)]);
    };