Search
 
SCRIPT & CODE EXAMPLE
 

C

create array

const fill = new Array(5).fill(0)
console.log(fill) // [ 0,0,0,0,0]

let filledArray = new Array(10).fill({'hello':'goodbye'});
Comment

declare array in javascript

const products=["watch", "pc", "mouse", "keyboard"];
Comment

how to declare an array in javascript

var array = [item1, item2, .....];
/*

  item1 and item2 could be a string (which is 
  a letter written in double or single quotes like this "string" or 'string') or 
  a number (which is just a normal number on the keypad) or a boolean (which is 
  an experssion which either returns to true of false) and the ..... means that 
  the inputs can be infinite.
  
*/
Comment

define array

const fruits = [
    "Apple",
    "Orange",
    "Mango",
    "Banana",
    "Cherry"
];
Comment

WHAT IS ARRAY AND HOW TO DECLARE ARRAY ?

// Quas : WHAT IS ARRAY AND HOW TO DECLARE ARRAY ?

// array is a single variable that is used to store different many of elements.

declare Array :
First you have to write var.
then you have to write a meaningful name.
then you have to give an equal sign.
then you have to give a third bracket.
then you have to give a single quotation inter the third bracket. 
then you have to give a element inter the single quotation.
then you have to give a comma. 
then you have to give a semicolon out of the third bracket .

example :
var friendsName = ['habib', 'iqbal', 'shorif', 'asraful', 'rasel', 'arif', 'deader' ];
Comment

declare an array

program arrayProg

   real :: numbers(5) !one dimensional real array
   integer :: matrix(3,3), i , j !two dimensional integer array
   
   !assigning some values to the array numbers
   do i=1,5
      numbers(i) = i * 2.0
   end do
   
   !display the values
   do i = 1, 5
      Print *, numbers(i)
   end do
   
   !assigning some values to the array matrix
   do i=1,3
      do j = 1, 3
         matrix(i, j) = i+j
      end do
   end do
   
   !display the values
   do i=1,3
      do j = 1, 3
         write(*,*) matrix(i,j)
      end do
   end do
   
   !short hand assignment
   numbers = (/1.5, 3.2,4.5,0.9,7.2 /)
   
   !display the values
   do i = 1, 5
      write(*,*) numbers(i)
   end do
   
end program arrayProg
Comment

PREVIOUS NEXT
Code Example
C :: Example of read and write project in c 
C :: how to declare a struct in c 
C :: linear and binary search 
C :: *= operator 
C :: create syscall 
C :: yt derived field 
C :: len of str vbs 
C :: fine print serial key 
C :: Print mark-sheet of students 
C :: Here is a program in C that illustrates the use of fprintf() to write a text file: 
C :: how to belu-roll peoples in c 
C :: convert c code to python online free 
C :: create a gtk window 
C :: delimter in c 
C :: konami code hdl 
C :: extended euclidean algorithm to find x and y 
C :: Uri/beecrowd problem no - 1131 solution in C 
C :: injection 
C :: c program boilerplate code 
C :: c byte vs char 
C :: logarithmus c math.h 
C :: C #define preprocessor 
C :: print hello world c 
C :: listas enlazadas/ linked lists 
C :: take array input from user and calc the avr in c 
C :: bucket sort 
C :: how to find the elements in array c coding 
Dart :: screen size flutter 
Dart :: rel canonical tag 
Dart :: round to decimal places dart 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =