javascript array
//create an array like so:
var colors = ["red","blue","green"];
//you can loop through an array like this:
for (var i = 0; i < colors.length; i++) {
console.log(colors[i]);
}
javascript array
//create an array like so:
var colors = ["red","blue","green"];
//you can loop through an array like this:
for (var i = 0; i < colors.length; i++) {
console.log(colors[i]);
}
What is Array?
• An array is a container object that holds a fixed number
of values of a single type. The length of an array is established
when the array is created. After creation, its length is fixed.
You have seen an example of arrays already, in the main
method of the "Hello World!" application.
This section discusses arrays in greater detail.
• Each item in an array is called an element,
and each element is accessed by its numerical index.
• Advantage of Java Array
o Code Optimization: It makes the code optimized,
we can retrieve or sort the data easily.
o Random access: We can get any data located at any index position.
• Disadvantage of Java Array
o Size Limit: We can store only fixed size of elements in the array.
It doesn't grow its size at runtime. To solve this
problem, collection framework is used in java.
array javascript
special_dates = [];
special_dates.push(new Date('2021/02/12').getTime());
special_dates.push(new Date('2021/02/13').getTime());
special_dates.push(new Date('2021/02/14').getTime());
for (var i = 0; i < special_dates.length; i++) {
console.log(special_dates[i]) ;
}
arrays
//Javascript Array
var fruitList = ["Bananas", "Apples", "Oranges"]
array
<!DOCTYPE html>
<html>
<body>
<script>
var str = ["1818-15-3", "1819-16-3"];
var arr = str.split(":");
document.write(arr[1] + ":" + arr[2]);
</script>
</body>
</html>
array
$ git config --global user.name "Yad Sallivann"
$ git config --global user.email [email protected]
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us