Created
January 18, 2018 03:04
-
-
Save dp-singh/e64f594067ef253e23b3c47be8da6d7e to your computer and use it in GitHub Desktop.
Type Script loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//declaration of array | |
var arr: number[]; | |
//initilization of array | |
arr = [1, 2, 3, 4, 5, 5, 6, 7, 8] | |
//for loop | |
for (var index = 0; index < arr.length; index++) { | |
console.log(arr[index]); | |
} | |
//entry control loop | |
var index = 0; | |
while (index < arr.length) { | |
console.log(arr[index]) | |
index++; | |
} | |
//exit control loop | |
var index = 0; | |
do { | |
console.log(arr[index]) | |
index++; | |
}while(index<arr.length) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment