GitHub 博客园 Nanakon

♫【JS基础】壹零零壹

如何面试一个前端开发者?

 

function spacify(str) {
    return str.split('').join(' ')
}
console.log(spacify('hello world'))

String.prototype.spacify = function() {
    return this.split('').join(' ')
}
console.log('hello world'.spacify())

function log() {
    var args = Array.prototype.slice.call(arguments)
    args.unshift('(app)')
    console.log.apply(console, args)
}
log('hello', 'world')

var User = {
    count: 1,
    getCount: function(x, y) {
        console.log(x, y)
        return this.count
    }
}
Function.prototype.bind = Function.prototype.bind || function(context) {
    var self = this
    return function() {
        return self.apply(context, arguments)
    }
}
console.log(User.getCount.bind(User)(1, 2))

 

posted on 2014-03-19 22:17  jzm17173  阅读(102)  评论(0编辑  收藏  举报

导航

轻音