Friday, June 9, 2017

Lab 16: Comparison Operators



     This lab was fairly easy as I understood how to create a calculator that will function differently from my other labs. This lab had an input value x and an output value y. I had buttons that had functions, such as x==y, x>y, x<y, x>=y, and x<=y. These functions were greater than, less than, greater or equal, less or equal, and compare. Compare was a function to compare both values to see if they are equal. I used JavaScript in this lab which was needed to get these values to work. Probably the only difficult about this lab was to find the tags to make this work.

This code below was used to get the first button to work;
//Comparison
function comp()
{
var x = document.getElementById("firstNum").value;
var y = document.getElementById("secondNum").value;
document.getElementById("demo").innerHTML = (x==y);
}


To sum up this lab was fairly easy and I will use this knowledge for future labs and projects.

No comments:

Post a Comment