Some methods commonly used in the development of an array of characters channeling summary

  Mounted () { 
    the let ARR = [ 'James', 'Wade', 'andonni', 'Bosh'] 
    the let A = [ 'James', 'Wade', 'andonni', 'Bosh'] 
    
    // the console.log ( arr.includes ( 'andonni')); // true inclues determines whether there 
    // console.log (arr.join ( 'golden generation')); // james wade generation golden golden golden generation andonni generally used for generation bosh join when passing data to the background 
    // splice (index required, howmany necessary, item1, ....., itemX optional) method to / add / remove items from the array, and then return the project to be deleted. index starting position howmany 0 does not remove other new digital deleted, the original array 
    // console.log (arr.splice (1,0, ' kewoer')); // string did not have to be a distinction only a slice of this splice array there slice and splice 
    // the console.log (ARR); // [ "James", "kewoer", "Wade", "andonni", "Bosh"] 
    // returns a new slice array, comprising from start to end (not including the element) 
       Console.
      // findIndex () method returns an array index of the first element satisfies the test function provided. Otherwise, it returns -1. 
      the console.log (a.findIndex (Item => { 
        Item === 'Bosh' 
      }), '++++++'); // index no. 3 is returned if -1 has the subscript own What do you do 

      
    the let STR = 'nbachapimcleavesKing James' 
    the console.log (str.includes ( 'James')); // to true 
    the console.log (str.endsWith ( 'S')); // to true 
    the console.log ( str.indexOf ( 'james')) // Get the value of a subscript 
    // string.slice (start, end) to extract a string string.substring (start, end) to extract a character string, end does not support the negative effect almost string.substr (start, len) to extract a character string of length len 
    console.log (str.slice (5, str.indexOf ( 'james'))) // cutout start position to the end position value apimcleavesKing 
  }

  

 To meet the needs of most developers




 

Guess you like

Origin www.cnblogs.com/myfirstboke/p/11204174.html