From e3d1e302a898814a60169f5d7fe4e60e049ae2c7 Mon Sep 17 00:00:00 2001 From: "Shebnem.M" Date: Fri, 22 May 2026 13:06:06 +0400 Subject: [PATCH] Solved lab --- index.js | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/index.js b/index.js index 6b0fec3ad..78abe642a 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,97 @@ // Iteration 1: Names and Input +let hacker1="Leyla"; +console.log("The driver's name is "+hacker1); +let hacker2="Kamran"; +console.log("The navigator's name is "+hacker2); // Iteration 2: Conditionals +const hacker1Length=hacker1.length; +const hacker2Length=hacker2.length; +if(hacker1Length>hacker2Length){ + console.log(`The driver has the longest name, it has ${hacker1Length} characters.`); +} +else if(hacker1Length=0; i--){ + reverse+=hacker2[i]; +} +console.log(reverse); + +if(hacker1hacker2){ + console.log("Yo, the navigator goes first, definitely."); +} +else{ + console.log("What?! You both have the same name?"); +} + +//Bonus 1: Lorem ipsum generator +const longText=`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros.` + +let wordCount=0; +let inword=false; +for(let i=0; i= 0; i--) { + newPhrase += cleanPhrase[i]; +} + +if (cleanPhrase === newPhrase) { + console.log("The phrase is a palindrome."); +} else { + console.log("The phrase is not a palindrome."); +} \ No newline at end of file