[removed] What are .extend and .prototype used for?

前端 未结 7 1027
渐次进展
渐次进展 2020-12-02 04:40

I am relatively new to JavaScript and keep seeing .extend and .prototype in third party libraries I am using. I thought it had to do with the Prototype javascript library, b

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 05:11

    This seems to be the clearest and simplest example to me, this just appends property or replaces existing.

    function replaceProperties(copyTo, copyFrom)  {
      for (var property in copyFrom) 
        copyTo[property] =  copyFrom[property]
      return copyTo
    }
    

提交回复
热议问题