JavaScript Arrays and Objects

 ----------------------------------------------------- index.html ----------------------------------------------

index.html

tut6.js

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>This is tutorial </h1>
</body>
<script src="tut6.js"></script>
</html>
---------------------------------------------------------------------------------
------------------------------------------------ tut6.js -----------------------
const marks = [12, 33, 54, 53, 83, 95];
const fruits = ['orange', 'apple', 'Pineapple'];
const arr = new Array(23,123,21,'Orange');



console.log(marks);
console.log(marks[2]) // array start count with 0
console.log(fruits[0]);
marks[1] = 'abhi'; // changin in marks array 33 value changed by abhi
console.log(marks);
let value = marks.indexOf(23);
console.log(value)
marks.push(3564); // end of the arry push value 3564
console.log(marks);
marks.unshift(1361); // push the 1361 value starting of the arraye
console.log(marks);

let myObj = { // this is the object
name: 'abhishek',
bike: 'apache',
car: 'scorpio',
mobile: '123456789'
}
console.log(myObj)
console.log(myObj.name)


Comments

Popular posts from this blog

React Native FlatList

React Native class component