• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ironhack-labs/lab-javascript-basic-algorithms: An exercise designed to learn bas ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

ironhack-labs/lab-javascript-basic-algorithms

开源软件地址:

https://github.com/ironhack-labs/lab-javascript-basic-algorithms

开源编程语言:

JavaScript 100.0%

开源软件介绍:

logo_ironhack_blue 7

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?

qrjeCm

Introduction

For this pair-programming activity we are going to have both people in the pair work in their own repos. At the end of the exercise, both students should have identical code in their respective repos.

Ready to start?

Requirements

  • Fork this repo

  • Clone this repo

  • Type this in the File Tab (left panel)

    console.log("I'm ready!");
  • Save

  • Open a terminal and navigate to the directory where the script file is, then issue the following command node js/index.js

  • If you can see the message in the terminal panel (bottom), you are really ready!

  • After the first iteration, or later at any point, or once you finish, 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.

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, print:
- The driver has the longest name, it has XX characters. or
- It seems that the navigator has the longest name, it has XX characters. or
- 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 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 of the strings, print:
- The driver's name goes first.
- Yo, the navigator goes first definitely.
- What?! You both have the same name?

Bonus Time!

Bonus 1:

Go to lorem ipsum generator 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 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. 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'


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap