From 888243d07bff75e925c429d640a9115377a83ed2 Mon Sep 17 00:00:00 2001 From: afiqzudinhadi Date: Sun, 28 Jul 2024 04:18:03 +0800 Subject: [PATCH] feat: add logic --- index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 3099947..a5a8965 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,16 @@ import { input } from '@inquirer/prompts'; -const answer = await input({ message: 'Enter your name' }); \ No newline at end of file +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) + } +} \ No newline at end of file