From 7ea9bfd7dc6535ac9440e3423ff2dffb03c6ad41 Mon Sep 17 00:00:00 2001 From: Mostafa Gad Date: Mon, 19 Mar 2018 16:52:43 +0100 Subject: [PATCH] doen --- .DS_Store | Bin 0 -> 6148 bytes starter-code/basic-algorithms.js | 85 +++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f542a5248d9ca92302cf78c92ae8daa652ca4e14 GIT binary patch literal 6148 zcmeHK&2AGh5FV$2dQ%WNRH8>;D)o?7Ne^u$gtUb8kOLB8D>%@q-R-XEO51gn-4HHaFZy1!(O&c!TTq0(x+5{q%X1=?Hu2*La4$_1hRm0FR)6 z5<(bYnP9mM=b#~mq@T_4e%zE7jfyKb-_PhOON+AI{v~QF^#>1ErEJK?Ndx_X$$g&8NX z9a4JIJ8f=^$GiLcEw$V3Oj>Gu&^c(Sz4qQ@;>o9*o#*|t%TJ%jUnXC_87V;EuW#&$ z!zp~nV5v|agF&9@`~&7p`BNSvE5Hh{0=KS!+j!*KtocUW08 zTL%{A34ln~NMjh&g^@VQq3^J=h&^b+QV}gxxF?3NbZl2H&v#f^v~&>e@gdyI!o5(0 znH|ShCLM%tkxN#96_{6G#a5ei{vR%X|Id@S#tN_k|CIuw-V1tN{3Lg_E_@uFwF>YjbXc@0MU0?S;Q7Jz6cl@xL^hDRDnOkk#I)< literal 0 HcmV?d00001 diff --git a/starter-code/basic-algorithms.js b/starter-code/basic-algorithms.js index 82f20d8ba..41d118490 100644 --- a/starter-code/basic-algorithms.js +++ b/starter-code/basic-algorithms.js @@ -1,3 +1,88 @@ +var hacker1 = "Mike"; +var hack1Len = hacker1.length + + +console.log("The Driver's name is " + hacker1); + +var hacker2 = prompt("What's your name?!"); +console.log("The navigator name is " + hacker2) +var hack2Len = hacker2.length; + + +if (hack1Len > hack2Len) { + console.log ("The Driver has the longest name, it has " + hack1Len + " characters") +} else if (hack2Len > hack1Len) { + console.log ("Yo, navigator got the longest name, it has " + hack2Len + " characters") +} else if (hack1Len === hack2Len) { + console.log("wow, you both got equally long names, " + hack1Len + " characters!!") +} + +var newHack = ""; +for (var i= 0; i=0; i--) { + new2Hack += hacker1[i]; +} + +console.log(new2Hack); + + +var arr = [] +arr.push(hacker1, hacker2); +arr = arr.sort(); + +if (arr[0] === arr[1]) { + console.log("What?! You both got the same name?") +} else if (arr[0] === hacker2) { + console.log("Yo, the navigator goes first definitely") +} else if (arr[0] === hacker1) { + console.log("The driver's name goes first"); +} + + +var example = prompt("Please provide a phrase!") +example = example.toLowerCase(); +var finish = "" +var reverseFinish = "" +for (var i = example.length-1; i>= 0; i--){ + if ((example[i].charCodeAt(0) >= 97) && (example[i].charCodeAt(0)) <= 122){ + reverseFinish += example[i] + } + +} + +for (var i = 0; i< example.length; i++){ + if ((example[i].charCodeAt(0) >= 97) && (example[i].charCodeAt(0)) <= 122){ + finish += example[i] + } + +} + +if (finish == reverseFinish){ + console.log("Is is a palindrome!") +} else { + console.log("Not a palindrome") +} + + +var para1 = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like)." + +para2 = para1.split(" "); + +console.log(para2); + +console.log(para2.length); + + + + + // Names and Input