Javascript String dashed()

Description

Javascript String dashed()


var number = {//w w w. j a  va 2  s  .c o m
    random: function () {
        return Math.random();
    },
    toto: function () {
        return 'toto';
    }
};

String.prototype.dashed = function () {
    return '-' + this;
};

console.log(number.random());
console.log(number.toto().dashed());



PreviousNext

Related