You have learn how to subtract binary numbers. However, this method is not suitable to implement in computer hardware. In this topic, you will learn how, using the same principles of binary addition, binary subtraction can be done. This method called Two's Complements can be easily be performed by computer hardware.
By the end of this lesson, you will be able to perform Binary Subtraction using Two Complements.
Estimated duration : 20 min
By the end of this course, you will learn how to
Decision Making
If you would only buy a car when you have $100,000, how would you express it in JavaScript using control statement?
If-else statement
How would you change the above control statement if I add in that if you have less than $100,000, then you would just buy a toy car?
if (money>100000)
buyCar=true;
else
buyToy=true;
You would add in the else statement as shown above. If the first condition (money > 100000) is not satisfied, the else block will be executed.
In this case, buyToy would be set to True when money is less than 100000.