-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathW2D6.js
40 lines (32 loc) · 941 Bytes
/
W2D6.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
1-Write a function called loopAString that takes one parameter, a string of characters,
and logs all of its characters (one at a time) to the console.
Your function should use a while loop to log each character
from the beginning to the end of the string, then return nothing.
Below is an example of the code running.
loopAString('nodeJS');
// console output:
// n
// o
// d
// e
// J
// S
loopAString('abcd');
// console output:
// a
// b
// c
// d
*/
function loopAString(string) {
// create an index variable
// create a loop which iterates over the input string
// log current string character to the console
// increment value of index variable
}
// 2-Write a function called reverseStr that takes a string as an parameter
//and returns the reverse of each letter
//followed by a number starting from zero(solve it using while loop).
// reverseStr('hello'); "o1l2l3e4h"
// Your code is here