How To Use String Split() Using JavaScript?


Share:
Published By: Admin, Published On: Nov 20, 2021, Category: Javascript


Hello Friends,

Now let's see example of how to use string split() example. We will check use of string split() using javascript. This is a short guide on use string split() in javascript. Let's get started with how to use string split() in javascript.

Here i will give you many example how to use string split() using javascript.

Example : 1
<!DOCTYPE html>  
<html>  
	<head> 
		<title>How To Use String Split() Using JavaScript? - MyWebtuts.com</title> 
	</head>  
	<body>  
	  	<h3>How To Use String Split() Using JavaScript? - MyWebtuts.com</h3>
		<script>  
			var str = 'Welcome to the My Webtuts.com'  
			var a1 = str.split(" ", 3);  
			document.write(a1);  
		</script>  
	</body>  
</html>  
Output :
Welcome,to,the,My
Example : 2
<!DOCTYPE html>
<html>
	<head>
		<title>How To Use String Split() Using JavaScript? - MyWebtuts.com</title>
	</head>
	<body>
		<h3>How To Use String Split() Using JavaScript? - MyWebtuts.com</h3>
		<script>
			var str = 'Welcome to the MyWebtuts.com'
			var a1 = str.split("t");
			document.write(a1);
		</script>
	</body>
</html>  
Output :
Welcome ,o ,he MyWeb,u,s.com

It will help you...

Share: