feat: add logic
This commit is contained in:
parent
a5bdff6fb9
commit
888243d07b
1 changed files with 14 additions and 1 deletions
15
index.js
15
index.js
|
|
@ -1,3 +1,16 @@
|
||||||
import { input } from '@inquirer/prompts';
|
import { input } from '@inquirer/prompts';
|
||||||
|
|
||||||
const answer = await input({ message: 'Enter your name' });
|
const answer = await input({ message: 'Enter your string:' });
|
||||||
|
|
||||||
|
const words = answer.split(' ')
|
||||||
|
|
||||||
|
for (let i = 0; i < words.length; i++) {
|
||||||
|
if (words[i][0] !== words[i][0].toUpperCase()) {
|
||||||
|
console.log(false)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i === words.length - 1) {
|
||||||
|
console.log(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue