Minggu, 27 Januari 2019

Slice() String Inwards Javascript

          Return the selected value from string, nosotros tin choose the string value past times using index. If the specified index value is outof attain in addition to hence it volition furnish the -1.
slice() method for array values


Syntax
      string.slice(startindex[,endindex]);

 endindex is the optional.

Example
 str="Merbin joe" ;

alert(str.slice(3));   //return from tertiary grapheme ["bin joe"]
alert(str.slice(3,5)); //return iii to fifth grapheme ["bi"]

Example Program:- (Editor)


Editor is Loading...

Advertisement

Join 2 Array String Using Concat()

     concat method is used to bring together 2 or to a greater extent than arrary or strings. This method does non alter the existing(old) value, precisely supply the joined value(new value).

Syntax
 string1.concat(string2);
or
array1.concat(array2);


Example 1
 var str1="Allinworld";
var str2="99";

alert(str1.concat(str2));



Example 2
  var ar1 = ["A","B","C"];
 var ar2 = ["D","E","F"];
alert(ar1.concat(ar2));



Example Program:- (Editor)


Editor is Loading...

Advertisement

How To Classify In Addition To Opposite Inward Array Numbers Using Javascript

     In javascript volition when nosotros utilisation the sort() method to form the array, I volition non rank the exact final result for numbers, it volition form the words only.

eg:)
    var ar=[45,9,200];
     Although nine is numerically smaller than 45 or 200, lexicographically, it is larger, together with then nine appears at the really correct of the sorted array. Remember, past times default array.sort() sorts its elements inwards lexicographical order.

Answer is
    ar.sort()   => [9,45,200]

 So nosotros tin cease utilisation the next method to solve this problem.


sort() for numbers
     ar_num.sort(function(a, b)
    {
      provide a - b;
    });


reverse() for numbers
     ar_num.sort(function(a, b)
    {
      provide b - a;
    });

Example Program:- (Editor)


Editor is Loading...

Advertisement





Tag:
sort() method non working inwards numbers, reverse() non working inwards disclose inwards javascript, allinworld99 to solve disclose sort() together with reverse() method.

Reverse The Array Value Inwards Javascript Reverse() Method

     Javascript array reverse() method reverses the chemical cistron of an array. The commencement array chemical cistron becomes the final together with the final becomes the first.
sort() inward javascript
How to sort/reverse about publish inward array

Note:
 Remember, past times default array.reverse(), opposite its elements inward lexicographical order.

Syntax:
  myarray.reverse();

Example Program:- (Editor)


Editor is Loading...

Advertisement




Tag:
how to opposite the array value inward javascript, job of reverse() inward javascript, decending companionship inward array value.

70 Hazar Enam (Prize) Blood-Red Circle Walay Shukas Ki Itlah Denay Per


Video No 1




Video No 2

How To Enshroud In Addition To Present Difficult Disk Drives Inward My Figurer Urdu|Hindi






Click the nether push together with Subscribe our Youtube Channel for novel updates.



How To Install All Windows Xp, 7,10 Etc Drivers Urdu|Hindi






Click the nether push together with Subscribe our Youtube Channel for novel updates.