码迷,mamicode.com
首页 > 其他好文 > 详细

Methods

时间:2018-03-29 21:17:20      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:from   UNC   ons   removing   har   bsp   log   efi   script   

  • string.prototype.trim()

    • The trim() method removes whitespace from both ends of a string. Whitespace in this context is all the whitespace characters (space, tab, no-break space, etc.) and all the line terminator characters (LF, CR, etc.).
    • Description

      The trim() method returns the string stripped of whitespace from both ends. trim()does not affect the value of the string itself.

    • var orig = ‘   foo  ‘;
      console.log(orig.trim()); // ‘foo‘
      
      // Another example of .trim() removing whitespace from just one side.
      
      var orig = ‘foo    ‘;
      console.log(orig.trim()); // ‘foo‘
      

       

  • String.prototype.toUpperCase()

    •   The toUpperCase() method returns the calling string value converted to uppercase (the value will be converted to a string if it isn‘t one).
    • Description

      The toUpperCase() method returns the value of the string converted to uppercase. This method does not affect the value of the string itself since JavaScript strings are immutable.

      You cannot call this method on null or undefined (via Function.prototype.call, for example) , if you do, a TypeError will be thrown.

    • console.log(‘alphabet‘.toUpperCase()); // ‘ALPHABET‘
      

       

 

Methods

标签:from   UNC   ons   removing   har   bsp   log   efi   script   

原文地址:https://www.cnblogs.com/ruruozhenhao/p/8671959.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!