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
After 10M+ Views, 13k+ Upvotes: The Reddit Strategy That Worked for Me! 42 comments Getting first 908 Paid Signups by Spending $353 ONLY. 24 comments I talked to 8 SaaS founders, these are the most common SaaS tools they use 20 comments What are your cold outreach conversion rates? Top 3 Metrics And Benchmarks To Track 19 comments Hero Section Copywriting Framework that Converts 3x 12 comments Join our AI video tool demo, get a cool video back! 12 comments