Member-only story
Data Types — Fundamentals
Data…it’s everywhere…
Here are the Data Types:
Boolean: something is either true or false.
String: this is text (which can be numerical) that you cannot do mathematical operations on. If you try to do a computation with a string, it becomes NaN or Not a Number because the computer doesn’t think strings and numbers live harmoniously together. Small imagination I guess. Well, unless you do type coercion, then the computer is on board. But that’s a whole other fun blog. While a string seems innocuous, it’s the heart of how information is transferred on the internet between so many different languages on the backend — using JSON.stringify and JSON.parse. From my understanding, that’s how we can have so many different servers (Ruby, Node, etc) and they can all interface with different packets of data being sent out (http protocols have them as JSON/application or text). I’ll do more digging into that at another time.
var movieQuote = “Gentlemen, you can’t fight in here! This is the War Room!”;
movieQuote * 5 // NaN
A small nugget of type coercion being : parseInt() or String(), or adding a string to a number will return a string. (5 + ‘’ returns ‘5’).