Slice-2

 

Javascript slice function will extract data from string or an array. It require two parameters one is start point and second parameter is optional. if negative values are assigned then it will start from the end.

 
 
 
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <script> var str = "i love learnkode, the code learning platform."; var sliced = str.slice(3, -2); document.write( sliced ); </script> </body> </html>
Output