Skip to content
Closed

done #635

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# Configuration for probot-stale - https://github.com/probot/stale

# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 30

# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels: []

# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
# onlyLabels:
# - TestLabel

# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 2

# Label to use when marking as stale
staleLabel: stale

# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This pull request has been automatically marked as stale because it didn't have any recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
closeComment: >
This pull request is closed. Thank you.
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 30
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels: []
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
# onlyLabels:
# - TestLabel
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 2
# Label to use when marking as stale
staleLabel: stale
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This pull request has been automatically marked as stale because it didn't have any recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
closeComment: >
This pull request is closed. Thank you.
226 changes: 113 additions & 113 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,113 +1,113 @@
![logo_ironhack_blue 7](https://user-images.githubusercontent.com/23629340/40541063-a07a0a8a-601a-11e8-91b5-2f13e4e6b441.png)

# LAB | JS Basic Algorithms

Welcome to your first bootcamp exercise at Ironhack!

The goal of this exercise is to get you familiarized with the primitive data structures in JavaScript, which we just covered in the class. Feel free to reference lesson materials and don't limit yourself but be curious and use Google to explore multiple solutions.

Ready?

## Introduction

For this **pair-programming** activity we are going to use a [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop). You can find a REPL that runs in the browser for programming languages as JavaScript in [https://repl.it/languages/nodejs](https://repl.it/languages/nodejs).

Ready to start?


## Requirements

- Fork this repo
- Clone this repo
- Go to [repl.it](https://repl.it/languages/nodejs) and create an account (or login if you have one)
- Type this in the *Code Editor* (left panel)

```javascript
console.log("I'm ready!");
```
- Press `run ►`
- If you can see the message in the right side panel, you are really ready!

<!-- ![](https://i.imgur.com/4TQislb.png) -->
![](https://s3-eu-west-1.amazonaws.com/ih-materials/uploads/upload_17f095b9bb4fa4bd1bee1c017c043327.png)

- __When you are done completely or at any point after the first iteration, copy your code into the `js/index.js` file and follow the steps for submission.__

## Submission

Upon completion, run the following commands:
```
$ git add .
$ git commit -m "done"
$ git push origin master
```
Create Pull Request so your TAs can check up your work.

_You should make a PR (stands for Pull Request) as soon as you make any significant change. You shouldn't have to wait until you're completely done with this or any other exercise to make the PR. After you do the first PR, any other time you push the changes (following the previous three steps), your change will appear automatically on the PR and your TAs will be able to check it._

<!-- ## Submission -->

<!-- When you are done and you have checked that everything works fine, click on the **Share** button and copy the link from the *Share Link* field. Send this link to your TAs so they can check up your work.
![](https://s3-eu-west-1.amazonaws.com/ih-materials/uploads/upload_b2aa98f91affe5d4c5f12f216b069184.png) -->

## Instructions

### Iteration 1: Names and Input

1.1 Create a variable `hacker1` with the driver's name.

1.2 Print `"The driver's name is XXXX"`.

1.3 Create a variable `hacker2` with the navigator's name.

1.4 Print `"The navigator's name is YYYY"`.

### Iteration 2: Conditionals
2.1. Depending on which name [is longer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length), print:
<br>
- `The driver has the longest name, it has XX characters.` or <br>
- `It seems that the navigator has the longest name, it has XX characters.` or <br>
- `Wow, you both have equally long names, XX characters!`.

### Iteration 3: Loops
3.1 Print all the characters of the driver's name, separated by a space and [in capitals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)
i.e. `"J O H N"`

3.2 Print all the characters of the navigator's name, in reverse order.
i.e. `"nhoJ"`

3.3 Depending on the [lexicographic order](https://en.wikipedia.org/wiki/Lexicographical_order) of the strings, print: <br>
- `The driver's name goes first.` <br>
- `Yo, the navigator goes first definitely.` <br>
- `What?! You both have the same name?`

### Bonus Time!

#### Bonus 1:
Go to [lorem ipsum generator](http://www.lipsum.com/) and:
- Generate 3 paragraphs. Store the text in a variable type of string.
- Make your program count the number of words in the string.
- Make your program count the number of times the Latin word [`et`](https://en.wiktionary.org/wiki/et#Latin) appears.

#### Bonus 2:
Create a new variable `phraseToCheck` and have it contain some string value. Write a code that will check if the value we assigned to this variable is a [Palindrome](https://en.wikipedia.org/wiki/Palindrome). Here are some examples of palindromes:
- "A man, a plan, a canal, Panama!"
- "Amor, Roma"
- "race car"
- "stack cats"
- "step on no pets"
- "taco cat"
- "put it up"
- "Was it a car or a cat I saw?" and "No 'x' in Nixon".

__Hint__: If you use Google to help you to find solution to this iteration, you might run into some solutions that use advanced string or array methods (such as _join()_, _reverse()_, etc.). However, try to apply the knowledge you currently have since you can build pretty nice solution with just using `for` loop, `if-else` statements with some `break` and `continue`... Just sayin' :smiley:

## Extra Resources

- [String - MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)
- [if - MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else)
- [while - MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while)
- [for - MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for)


__Happy coding!__ :heart:
![logo_ironhack_blue 7](https://user-images.githubusercontent.com/23629340/40541063-a07a0a8a-601a-11e8-91b5-2f13e4e6b441.png)
# LAB | JS Basic Algorithms
Welcome to your first bootcamp exercise at Ironhack!
The goal of this exercise is to get you familiarized with the primitive data structures in JavaScript, which we just covered in the class. Feel free to reference lesson materials and don't limit yourself but be curious and use Google to explore multiple solutions.
Ready?
## Introduction
For this **pair-programming** activity we are going to use a [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop). You can find a REPL that runs in the browser for programming languages as JavaScript in [https://repl.it/languages/nodejs](https://repl.it/languages/nodejs).
Ready to start?
## Requirements
- Fork this repo
- Clone this repo
- Go to [repl.it](https://repl.it/languages/nodejs) and create an account (or login if you have one)
- Type this in the *Code Editor* (left panel)
```javascript
console.log("I'm ready!");
```
- Press `run ►`
- If you can see the message in the right side panel, you are really ready!
<!-- ![](https://i.imgur.com/4TQislb.png) -->
![](https://s3-eu-west-1.amazonaws.com/ih-materials/uploads/upload_17f095b9bb4fa4bd1bee1c017c043327.png)
- __When you are done completely or at any point after the first iteration, copy your code into the `js/index.js` file and follow the steps for submission.__
## Submission
Upon completion, run the following commands:
```
$ git add .
$ git commit -m "done"
$ git push origin master
```
Create Pull Request so your TAs can check up your work.
_You should make a PR (stands for Pull Request) as soon as you make any significant change. You shouldn't have to wait until you're completely done with this or any other exercise to make the PR. After you do the first PR, any other time you push the changes (following the previous three steps), your change will appear automatically on the PR and your TAs will be able to check it._
<!-- ## Submission -->
<!-- When you are done and you have checked that everything works fine, click on the **Share** button and copy the link from the *Share Link* field. Send this link to your TAs so they can check up your work.
![](https://s3-eu-west-1.amazonaws.com/ih-materials/uploads/upload_b2aa98f91affe5d4c5f12f216b069184.png) -->
## Instructions
### Iteration 1: Names and Input
1.1 Create a variable `hacker1` with the driver's name.
1.2 Print `"The driver's name is XXXX"`.
1.3 Create a variable `hacker2` with the navigator's name.
1.4 Print `"The navigator's name is YYYY"`.
### Iteration 2: Conditionals
2.1. Depending on which name [is longer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length), print:
<br>
- `The driver has the longest name, it has XX characters.` or <br>
- `It seems that the navigator has the longest name, it has XX characters.` or <br>
- `Wow, you both have equally long names, XX characters!`.
### Iteration 3: Loops
3.1 Print all the characters of the driver's name, separated by a space and [in capitals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)
i.e. `"J O H N"`
3.2 Print all the characters of the navigator's name, in reverse order.
i.e. `"nhoJ"`
3.3 Depending on the [lexicographic order](https://en.wikipedia.org/wiki/Lexicographical_order) of the strings, print: <br>
- `The driver's name goes first.` <br>
- `Yo, the navigator goes first definitely.` <br>
- `What?! You both have the same name?`
### Bonus Time!
#### Bonus 1:
Go to [lorem ipsum generator](http://www.lipsum.com/) and:
- Generate 3 paragraphs. Store the text in a variable type of string.
- Make your program count the number of words in the string.
- Make your program count the number of times the Latin word [`et`](https://en.wiktionary.org/wiki/et#Latin) appears.
#### Bonus 2:
Create a new variable `phraseToCheck` and have it contain some string value. Write a code that will check if the value we assigned to this variable is a [Palindrome](https://en.wikipedia.org/wiki/Palindrome). Here are some examples of palindromes:
- "A man, a plan, a canal, Panama!"
- "Amor, Roma"
- "race car"
- "stack cats"
- "step on no pets"
- "taco cat"
- "put it up"
- "Was it a car or a cat I saw?" and "No 'x' in Nixon".
__Hint__: If you use Google to help you to find solution to this iteration, you might run into some solutions that use advanced string or array methods (such as _join()_, _reverse()_, etc.). However, try to apply the knowledge you currently have since you can build pretty nice solution with just using `for` loop, `if-else` statements with some `break` and `continue`... Just sayin' :smiley:
## Extra Resources
- [String - MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)
- [if - MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else)
- [while - MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while)
- [for - MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for)
__Happy coding!__ :heart:
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Javascript</title>
</head>
<body>
<h1>javascript</h1>

<script type="text/javascript" src="./js/index.js"></script>
</body>
</html>
67 changes: 60 additions & 7 deletions js/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,60 @@
// Iteration 1: Names and Input


// Iteration 2: Conditionals


// Iteration 3: Loops
// Iteration 1: Names and Input


//1.1 Create a variable `hacker1` with the driver's name.
let hacker1 = "Carles";

//1.2 Print `"The driver's name is XXXX"`.*/
console.log ("The Driver's name is " + hacker1);

//1.3 Create a variable `hacker2` with the navigator's name.
let hacker2 = "Galí"

//1.4 Print `"The navigator's name is YYYY"`.
console.log ("The navigator's name is " + hacker2)


// Iteration 2: Conditionals


if (hacker1.length > hacker2.length){
console.log ("The driver has the longest name, it has " + hacker1.length + " characters.")
} else if (hacker1.length < hacker2.length) {
console.log ("It seems that the navigator has the longest name, it has " + hacker2.length + " characters")
} else {
console.log ("Wow, you both have equally long names, " + hacker1.length + " characters")
}


// Iteration 3: Loops


//3.1 Print all the characters of the driver's name, separated by a space and in capitals i.e.
let hacker1Capital = "";

for (let i = 0; i < hacker1.length ; i++){
hacker1Capital += `${hacker1[i]}` + " ";
};

console.log(hacker1Capital.toUpperCase())




//3.2 Print all the characters of the navigator's name, in reverse order. i.e. "nhoJ"
let hacker2Reverse = "";

for (let i = hacker2.length-1; i >= 0; i--){
hacker2Reverse += `${hacker2[i]}`;}

console.log(hacker2Reverse.toUpperCase())

//3.3 Depending on the lexicographic order of the strings, print:

if (hacker1 < hacker2) {
console.log("The driver's name goes first")
} else if (hacker1 > hacker2){
console.log("The navigator goes first definitely")
} else {
console.log("What?! You both got the same name?")
}