1
7 Comments

Help with my code

Would anyone be so kind as to help me write this code? Below is an assignment as a test to get into a coding boot camp that I really wanted to join. Can someone tell me how to write this code?

First, declare a variable named myArray and assign it to an empty array.
Now populate myArray with two strings:
Put your full name in the first string, and your favorite color in the second.
Next, declare a function named cutName. It should expect a parameter name.
cutName should return an array by breaking up the input string into individual words.
Example: cutName("Douglas Crockford") should return ["Douglas", "Crockford"]
Example: cutName("John B. Smith") should return ["John", "B.", "Smith"]
Declare a new variable named myInfo and assign it to an empty object literal.
Add the following three key-value pairs to myInfo:
Key: fullName
Value: The result of calling cutName on the name string within myArray.
Key: favoriteColor
Value: The color within myArray.
Key: github
Value:If you have a github handle, enter it here as a string. If not, set this to null instead.

  1. 2

    If you don't know how to declare a variable, and the boot camp wants you to be at the level that you can write this code easily, then why do you think you would be successful at this boot camp? More likely, they would start at a level you are not ready for, you will fall far behind, and the whole experience will be a waste of time and money for everyone.

    That said, you can learn to do this, and I believe in you. Here's how to write this code:

    1. learn what a variable is
    2. learn to define variables
    3. learn what a function is
    4. learn how functions use returns and paramenters
    5. learn to create a function
    6. learn what a JSON or object literal look like.
    7. write this very simple code. It's probably less than 10 lines. You can learn this, you can do it!

    Some resources to get started:

    All of these are things you can do in a day or two if you really focus. Good luck, friend.

    1. 1

      I second this. The test isn't just some brick wall for you to walk around. It's to make sure you are at the place where you can get the most out of the bootcamp.

      Even if you hustle your way in, everything else builds on those foundations, and you'll struggle the whole time. The experience won't be worth your money if you do that.

  2. 1

    If you're struggling with how to code this, I believe you should take 2 hours to watch this video on javascript and follow along. Pause when you need to.

    If you need something clarified, message me on Twitter

    https://youtu.be/hdI2bqOjy3c

    1. 1

      Nice. Thanks man. I have the first half, the only thing that I'm having trouble with is separating the arrays into two names.

  3. 1

    Appreciate the feedback. I'll look into those resources. I wasn't initially learning Java, so it's definitely new. I've been working more out of swift.

    1. 1

      Javascript. Not java. They are asking you about javascript things, so go for that first. Please dont go learn java now to be clear. If you dont know what declare a variable means then no, you arent working in swift. I think you need to take a serious look at what you are building and learning and how you are spending your time. Seriously wishing you the best, but your response is really concerning

      1. 1

        What is concerning about this? All of this is new for me, hence the Bootcamp to learn what I need. Everyone starts at a point of not knowing.

        Also, what I've shared may have been a little misleading. I know how to declare a variable, I'm past that part, the only part I'm struggling with is breaking the array input into individual words. I haven't been coding for long. It's all new to me, everyone was once a novice. Thanks for the good wishes but not really sure if you're advising against starting my coding journey or not.

Trending on Indie Hackers
Promote your Slack/Discord showing the best community's posts on your site 15 comments I accidentally started a publishing business, now doing £500K/ARR. AMA! 10 comments New IH Feature : Downvote posts 10 comments WFH? No thank you 5 comments The key to mastery in any discipline is consistency 4 comments Hit 100k ARR @ week 36 - Update 1 of 48, Week - 10-26-20 4 comments