Hi dear welcome to "CodePrime" Blog . In this post you are going to learn how to use arays element. First Creat A index.html file Copy This HTML CODE and pest it one your code editor. 2ndly creat arays.js file Then Copy The JS CODE and pest it then. Next connect arays.js file with your index.html header open the index.html file with your browser.
HTML CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="/js/arays.js"></script>
<title>premitive data type</title>
</head>
<body>
<h2>Javascript Tutorial</h2>
<h3>By Codeprime</h3>
</body>
</html>
JAVASCRIPT CODE
let shopping=[];
shopping=['paintbrash','color','canvas','paper'];
console.log(shopping);
//example
let numbers=[];
numbers=[1,2,3,4,5];
console.log(numbers[0] + numbers[1]);
console.log(numbers.sort());
numbers.push(6);
console.log(numbers);
//example
let mix=[];
mix=['one',1,'two',2];
console.log(mix);
0 Comments