Skip to content

Instantly share code, notes, and snippets.

@michhub-dev
Created May 22, 2020 10:44
Show Gist options
  • Save michhub-dev/e36d394d8a022791675db4d65fb27292 to your computer and use it in GitHub Desktop.
Save michhub-dev/e36d394d8a022791675db4d65fb27292 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/yerudug
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
var myArray =[];
var newArray = [23, "i'm liking js", true];
var anotherOne = ["micky", "david", "miky", "dav"];
var mug = {
name: "joe",
midName: "john"
};
var sim = 10;
var mugArray = [sim, "cup", "soup", false, mug];
mugArray[4].midName = "micky";
mugArray[0]= 30;
//concatnate two element
anotherOne.concat(mugArray);
//look for a value in the array
mugArray.indexOf(mug);
//add a new elememt to the array
anotherOne.push("cup");
//remove last element
anotherOne.pop();
//remove the first element
anotherOne.shift();
//iterate over an element
var upperAnotherOne = [];
function upperCaseElement (func, intex, aroy){
upperAnotherOne.push(func.toUpperCase());
}
anotherOne.forEach(upperCaseElement);
</script>
<script id="jsbin-source-javascript" type="text/javascript">var myArray =[];
var newArray = [23, "i'm liking js", true];
var anotherOne = ["micky", "david", "miky", "dav"];
var mug = {
name: "joe",
midName: "john"
};
var sim = 10;
var mugArray = [sim, "cup", "soup", false, mug];
mugArray[4].midName = "micky";
mugArray[0]= 30;
//concatnate two element
anotherOne.concat(mugArray);
//look for a value in the array
mugArray.indexOf(mug);
//add a new elememt to the array
anotherOne.push("cup");
//remove last element
anotherOne.pop();
//remove the first element
anotherOne.shift();
//iterate over an element
var upperAnotherOne = [];
function upperCaseElement (func, intex, aroy){
upperAnotherOne.push(func.toUpperCase());
}
anotherOne.forEach(upperCaseElement);</script></body>
</html>
var myArray =[];
var newArray = [23, "i'm liking js", true];
var anotherOne = ["micky", "david", "miky", "dav"];
var mug = {
name: "joe",
midName: "john"
};
var sim = 10;
var mugArray = [sim, "cup", "soup", false, mug];
mugArray[4].midName = "micky";
mugArray[0]= 30;
//concatnate two element
anotherOne.concat(mugArray);
//look for a value in the array
mugArray.indexOf(mug);
//add a new elememt to the array
anotherOne.push("cup");
//remove last element
anotherOne.pop();
//remove the first element
anotherOne.shift();
//iterate over an element
var upperAnotherOne = [];
function upperCaseElement (func, intex, aroy){
upperAnotherOne.push(func.toUpperCase());
}
anotherOne.forEach(upperCaseElement);
@michhub-dev
Copy link
Author

practice lessons on arrays

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment