And/Or JavaScript

When you are going to use and/ or statement it is important to 1:

and &&, or ||

and then to make sure that you are looking at it correctly. What do you want to happen:

game is on and have beer : smile

game is on or have beer : smile

They come out differently, most of the time and will give the right result for a Sunday afternoon. But the other will only give a Sunday afternoon some fun.

If else in Java Script

Here is an example of some basic structure for a if else statement. I will write more in a few days but this is all I have time for today.

 

// quiz
var correct = 0;

var question1 = prompt(‘Name the first number’);
if (question1.toUpperCase () === ‘1’) {
correct += 1;
}
var question2 = prompt(‘2nd number’);
if (question2.toUpperCase () === ‘2’) {
correct += 1;
}
var question3 = prompt(‘3rd number’);
if (question3.toUpperCase () === ‘3’) {
correct += 1;
}
var question4 = prompt(‘4th number’);
if (question4.toUpperCase () === ‘4’) {
correct += 1;
}
docment.write(‘<p>You got ‘ + correct + ‘out of 4 questions.<p/>;

if (correct === 4 ) {
document.write(‘<p> You earned a gold cup</p>’);
} else if (correct === 3) {
document.write(‘<p> You earned a silver cup</p>’);
} else if (correct <= 2) {
document.write(‘<p> You earned a tin cup</p>’);
}

It will run but it will need a few corrections and more clear text. But for an example of getting a person to use an if else, this will work.

Boolean in JS

There are ways to use a Boolean value in Java Script. I will add other articles in a day or two. But I just wanted to log these here. Also talking about if/else, and randomInt

var correctGuess = false;
var randomNumber = Math.floor(Math.random() * 6) + 1;
var guess = prompt(‘I am thinking of a number between 1 and 6. What is it?’);
if (parseInt(guess) === randomNumber) {
document.write(‘<p>You guessed the number!</p>’);
}
{ correctGuess = true;
}
if (correctGuess===true) {
document.write(‘<p>You guessed the number!</p>’);
} else {
document.write(‘<p>Sorry, The number was ‘ + randomNumber + ‘.</p>’);

Math objects in js

There are math functions built into js to do the heavy lifting on math and algorithms that are needed in a program. I only have gone through finite math in college. No trig or calc. But I do understand and can solve calc problems. I just don’t understand them.

Anyway, there are entire calculations for js

Math.round()

Math.floor() returns the closest whole integer to the whole number as in gas 1.049 is then 1. This would stink for a teacher to use in class. If a student got a 89.95, they would have an 89.

As I get older I sure do understand numbers more. Probably just like that there is only one answer.

Then there is putting it into an alert,

alert(Math.round(‘38.5 degrees’); will give 39 as the answer.

I think that at the end of the math you can put an ; with no problems but their is none unless it is inside another code sequence.

 

 

 

 

SPen Shapes

There is a package that will allow you to draw a shape on the snote app and it will change the shape into a recognizable shape. This did work and with the available pens and push sensitive ability it was interesting to write in. I will next test useing the pen to write in text messages. I tried it in writing a comment in LinkedIn and it kind of worked for me. It was mostly me getting use to it but there seems to be some learning that I need to do. I really want to see if I can draw a picture and text it.

SPen Youtube

I have watched a few videos about the SPen. There are some really talented people out there. They cover the entire ability of the pen. Some give more examples then others. There is so much that it can do. But does that align with my needs? I can tell you that  if I need to record or get a contact down, this phone is in no way as fast, or makes a connection with my brain as an Iphone does to users. Many times Iphone users are just so connected with their phone that they have pulled it out and gotten something down and said they will text it to me. The simplicity of design is definitely worked into an Iphone. There is just so much repetition of phone manipulation that is similar in every app on an Iphone that it is just an extension of the person.

SPen lock screen

I did find a use for the SPen and the lock screen. I used it to show some simple math problems. I used it as a white board no markers or erasers needed. That was helpful. But I really have not used it to write down a number or a note. I just take a picture or open the phone and speech to text myself. But I will try it. Maybe I need to just find things that I need to write down and write it down so I remember it is there?

Note 5 Articles

I use the Note 5 as my daily driver and I only like to have one phone at a time. Plus no one is giving me tech to review. But I do have to say that the size is no were as much of a problem once I get use to it.

But there is the S Pen. I really have only pulled it out a few times. I would think that if someone made one for a tablet that would be great. I know that there are Windows and IOS units but no Google based.

So I am going to be writing about using the Note 5 as a business tool and see if I can really use it for my work or is it just not functional for me.

So I will be reviewing Youtube videos on how and where people find used for it. And try to see if I find it really helpful to me. I am not a note taker or a calendar checker. I mostly just ask my wife in a text or check my work calendar if I am not sure about that day. So we will see maybe this will improve my organizing. I could use the help in remembering to stop by Walmart or the store for that one think that I always forget!

No repeat code

In programming I guess that there is a concept for keeping the lines of code from repeating. Don’t type the same line of code in the same program. I can remember on legacy systems that there was not much memory so there was a limit to how much code a program could call up from the memory and cpu. But that is not the function anymore. But good code is an elegant thing. When code can be called up fast it uses less memory and pulls less on the cpu. Even though newer computers wouldn’t notice much it is still good to streamline as much as possible.