1function factorial(n) {
2 if (n == 0) {
3 return 1;
4 } else {
5 return factorial(n - 1) * n;
6 }
7}
1function linearSearch(value, list) {
2 let found = false;
3 let position = -1;
4 let index = 0;
5
6 while(!found && index < list.length) {
7 if(list[index] == value) {
8 found = true;
9 position = index;
10 } else {
11 index += 1;
12 }
13 }
14 return position;
15}
16
1// Define a function that prints a stringfunction welcomeMessage() { console.log('Welcome to JavaScript');}// Call the functionwelcomeMessage();