Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkBossInputs(inputs) {
- const numInputs = parseInt(inputs[0]);
- for (let i = 1; i <= numInputs; i++) {
- const bossInfo = inputs[i].trim();
- console.log(bossInfo);
- // Check if boss name and title are valid
- const regex = /\|([A-Z]{4,})\|\:\#([A-Za-z]+\s[A-Za-z]+)\#/gm;
- const match = Array.from(bossInfo.matchAll(regex), res => {
- return {name: res[1], title: res[2]}
- })[0];
- if(match){
- console.log(`${match.name}, The ${match.title}\n>> Strength: ${match.name.length}\n>> Armor: ${match.title.length}`);
- } else {
- console.log("Access denied!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement