Answers for "array []"

140

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]);
}
Posted by: Guest on July-01-2019
3

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.
Posted by: Guest on May-16-2021
1

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]) ;
}
Posted by: Guest on February-04-2021
0

arrays

//Javascript Array
var fruitList = ["Bananas", "Apples", "Oranges"]
Posted by: Guest on October-02-2020
0

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>
Posted by: Guest on May-22-2021
0

array

$ git config --global user.name "Yad Sallivann"
$ git config --global user.email [email protected]
Posted by: Guest on June-13-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language