Substr-3

 

JavaScript substring function is used to extract string from string, There are two parameter where first one parameter is start and second one is optional.


 
 
 
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <script> var anyString = 'Mozilla'; var result= anyString.substring(anyString.length - 4); document.write(result); </script> </body> </html>
Output