Skip to content

Instantly share code, notes, and snippets.

@humayunahmed8
Last active June 28, 2018 10:28
Show Gist options
  • Save humayunahmed8/664187c4cb47eabfabd40beb94399a38 to your computer and use it in GitHub Desktop.
Save humayunahmed8/664187c4cb47eabfabd40beb94399a38 to your computer and use it in GitHub Desktop.
Javascript Array.
//Array with multiple line
var data=[];
data[0]=10;
data[1]=20;
data[2]=30;
data['name']='blackdiamond';
data['designation']='teacher';
data['country']='USA';
document.write(data[2]);
// call to all value using for/in loop
for(var a in data){
document.write(data[a]+'<br/>');
}
// array with single line
var data = ['Moshiur', 'Dhaka', 'Bangladesh'];
document.write(data[0]);
// Array Length
var meHumayun = ['Developer', 'Nizkunjara', 'Bangladesh'];
document.write(meHumayun.length-1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment