Split-3

 

JavaScript split function with second parameter that specify the number of splits.

 
 
 
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <script> var str = "I love learnkode, Learn the code with examples."; var result= str.split(" ", 3); document.write(result); </script> </body> </html>
Output