Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!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">
- /*
- 21/11/2017
- printReverse()
- Write a function printReverse() that takes an array as an argument and prints out the elements in the array in reverse order (don't actually revese the array itself
- */
- //printReverse([1,2,3,4]);
- //4
- //3
- //2
- //1
- function printReverse (arr) {
- for (var i = arr.length - 1; i >= 0 ; i--) {
- console.log(arr[i]);
- }
- }
- printReverse([5,4,3,2,1]);
- </script>
- <script id="jsbin-source-javascript" type="text/javascript">/*
- 21/11/2017
- printReverse()
- Write a function printReverse() that takes an array as an argument and prints out the elements in the array in reverse order (don't actually revese the array itself
- */
- //printReverse([1,2,3,4]);
- //4
- //3
- //2
- //1
- function printReverse (arr) {
- for (var i = arr.length - 1; i >= 0 ; i--) {
- console.log(arr[i]);
- }
- }
- printReverse([5,4,3,2,1]);</script></body>
- </html>
Add Comment
Please, Sign In to add comment