Coding BootCamp & [Hint for largestProductOfThree] 
Tags: beginners, javascript
Published: 2020-01-20 03:06:44

Hello, my name is Kenny, this will be my first very post of a blog! I'm currently immersed in a coding boot-camp, so I'll be using this platform to be blogging about my experiences in the boot-camp and my required blogging assignments here!

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/iknktrby8hhckvgb7vvc.jpg)

The program has been really great, the instructors at Operation Spark are here to help you improve in coding and in yourself. Instructors here gives constructive feedback that are not meant to offend but to help students improve and let them know on what areas to to work on. The program here ultimately teaches students JavaScript and autonomy. Autonomy I've learned is becoming much more self-sufficient and continuing to learn coding even after finishing class for the day. 

This is the end week 2 of my immersion course, and so far we've gone through numerous exercises and sprints, and Dang were they difficult. This week we were introduced toy-problems, That got my brain juices flowing into over-drive. These problems can have a really simple solution or a very complicated solution depending on ones thought process. But it really helps on learning varies ways on solving a problem, such as breaking down a problem and take it in manageable pieces. 
One problem we've been tasked to work on was a toy-problem: 

"largestProductofThree"

A few thing that the boot camp has taught me was to get a GRASP of what the function should do, just to get a better understanding of how it operates.
Afterwards we can plan accordingly on how we would solve this problem. 
This problem takes in an array of numbers and spits back out the highest number possible out of three of the highest possible numbers.

```javascript 
const largestProductOfThree = (array) => {
}; 
```

Since we know it takes an array, we could sort the array using .sort(). that way the numbers in the array will be in order from least to greatest.

```javascript
array.sort((a, b) => a - b);
```

from here we could actually set the code above into a variable, so that way it wouldn't look as confusing in trying to solve the rest on the problem. 


So lets initialize a variable of our sorted array.
```javascript
let sorted = array.sort((a, b) => a - b);
```

Now that we have our sorted array in a variable we know what we're working on.
since this function wants the highest number possible in an array of numbers, and our array is sorted from least to greatest, we can just multiply the last three indexes of our sorted array.

```javascript
let greatThree = 
   sorted[sorted.length - 1] * sorted[sorted.length - 2] * sorted[sorted.length - 3];
```

This way greatThree will always equal to the highest three multiple numbers in the sorted array. 
Now our code should look something like this:

```javascript
const largestProductOfThree = (array) => {
     let sorted = array.sort((a, b => a - b);
     let greatThree = 
   sorted[sorted.length - 1] * sorted[sorted.length - 2] * sorted[sorted.length - 3];
};
```
Now that is not it for this problem, it ALSO wants us to incorporate if the numbers in the array are negative as well.
I won't spoil the rest of the solution for us, hoping you could figure out the rest for yourself. I wish you best of luck!

I'll be doing doing a weekly blog post on my progress within the bootcamp with a little hint of another problem I happen to stubble upon.
Thank you for taking the time to skim over this!

Like & Follow on my Progress!