Answers for "arrays javscript"

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
2

js array

//create an array
let numbers = [ 11 , 13 , 15 , 17]

//you can use loop like this
for(let i = 0;i<numbers.length;i++) {
	console.log(numbers[i])
}
Posted by: Guest on April-17-2021
4

js arrays

// Making an array:
const colors = ["red", "orange", "yellow"];

// Arrays are indexed like strings:
colors[0]; // "red"

// They have a length:
colors.length; //3

// Important array methods:
//push(value) - adds value to the END of an array
//pop() - removes and returns last value in array

//unshift(val) - adds value to START of an array
//shift() - removes and returns first element in an array
Posted by: Guest on January-05-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

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

MNM
ARRAY
Posted by: Guest on June-02-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language