Skip to content

Conversation

yonathanh
Copy link

No description provided.


// Lorem ipsum generator
console.log("Driver's name");
for (let i = 0; i < hacker1.length; i++) {
console.log(hacker1[i].toUpperCase());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should make an empty space between each letter.


console.log("Nav's name");
for (let i = hacker2.length - 1; i >= 0; i--) {
console.log(hacker2[i]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is printing all the letters in the backward order, but also you need to put it back to the string.

console.log(hacker2[i]);
}

if (hacker1 < hacker2) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To sort the strings alphabetically, try using .localeCompare() or some other sorting method.

let palindrom = prompt("input a word to test for palindrom", "harry potter");

function checkPalindrom(palindrom) {
for (let i = 0, j = palindrom.length; i < palindrom.length; i++, j--) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is failing but if you make a small update where you assign value to the j it will work:

for (let i = 0, j = palindrom.length-1; i < palindrom.length; i++, j--) {
	// code goes here
}

@sandrabosk
Copy link
Contributor

Good work. Keep it like this. Thank you for submitting.

@sandrabosk sandrabosk closed this Aug 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy