This Weeks Progress #2


  Another week has gone by and I'm here to tell you a few things I learned.
There's not much to report but I did work on a Udacity course and read some JavaScript articles on Dev.to.

 So one of the articles I read was something that was not new to JavaScript but it was new to me. This feature known as .some( ) is used to check against an array to learn about data in an array. The example used which is at the bottom of this article is what I will be showing you. So lets say you want to know if a price of a certain item in the array goes above 20 dollars. Here is a bit of code to highlight my example.

const prices = [5, 8, 11, 10, 25]; //an array
const aboveTwenty = prices.some((price) => price > 20); //check the 
array for prices over 20

console.log(aboveTwenty); // true 


  Now for some insight into the Udacaity I am working through for JavaScript. To save us both time I will just go over one bit that stumped me a bit due to over thinking and trying to make it more complex (It's a normal trend I am trying to fix). The section was on conditionals such as if, else and else if statements. For the exercise I was suppose to write a block of code that used if, else and else if to find rather a number was odd using the modulo operation. While this should of been simple from the start I miss read an instruction which is where the trouble started. After messing around with it awhile, I decided to start over and reread the requirements to pass the quiz. And wouldn't you know, it just clicked and I got it done. Here is the bit of code I came up with.

var number = 5;

if (number%2 === 1) {
    console.log('odd');
}
else if(number%2 !== 1){
    console.log('even');
}
 else {
    console.log(number);
 }


For those wondering what the modulo function does, it finds the remainder after division. In this block of code I use strict comparing to get the logic to work. The === makes so it states that is has to be equal to be truthy or else it's falsy. That makes !== mean it has to absolutely be not equal to be truthy otherwise it's falsy. Here is a small table to help clarify it more.

1 == true     => true
true == true  => true
1 === true    => false
true === true => true


 That concludes my lessons this week and I hope you enjoy my coding information. If anything seems wrong or you would like to discuss this more hit me up on twitter @officalajsmith.

This weeks progress

Here is my first post and a week in review progress. This was brought about because of a group known as Let's Code. A few peers and myself decided to work on communication while passing on some information we learned.