Horje
Slice Example Code Example
slice method in js
// array.slice(start, end)
const FRUITS = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var citrus = FRUITS.slice(1, 3);
// citrus => [ 'Orange', 'Lemon' ]

// Negative values slice in the opposite direction
var fromTheEnd = FRUITS.slice(-3, -1);
// fromTheEnd => [ 'Lemon', 'Apple' ]
slice javascript
const string="Hi my name is mezen";
string.slice (2); // return string without the character of index 2;
string.slice (6); // return string without the character of index 6;

string.slice (3,7) /* return 'my na' (m of index 3; a of index 7) including the
                      blank spaces */
slice in js
//The slice() method extracts a section of a string and returns 
//it as a new string, without modifying the original string.
Slice Example
/*Use string concatenation and two slice() methods to print
'JS' from 'JavaScript'.*/

let language = 'JavaScript';
console.log(language.slice(0,1)+language.slice(4,5));

//JS




Javascript

Related
how to remove first element js Code Example how to remove first element js Code Example
Remove an item from the end of an Array Code Example Remove an item from the end of an Array Code Example
how to slice array of object in JavaScript Code Example how to slice array of object in JavaScript Code Example
pre selected data-grid material-ui Code Example pre selected data-grid material-ui Code Example
how to api data slice javascript Code Example how to api data slice javascript Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7