-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
35 lines (29 loc) · 803 Bytes
/
index.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
/*:::::::::::: REQUIRE :::::::::*/
var inquirer = require("inquirer");
var letterJS = require("./letter.js").getLtr;
/*:::::::::::: GLOBAL VAR :::::::::*/
var newPlayer = '';
// Initialize Application
nodeInit();
// get user's name
function getNme() {
console.log('----------------------');
console.log('Welcome to my WordGame');
console.log('----------------------\n');
inquirer.prompt([{
name: "name",
message: "Whats Your Name?"
}]).then(function (name) {
if (name.name.letter !== '') {
newPlayer =name.name;
// send name to the get letter function
letterJS(newPlayer.trim());
}else{
console.log('Silly... Enter A Name!');
getNme();
}
});
}
function nodeInit() {
getNme();
}