Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * CONTROL FLOW:
- *
- * 0. Control flow is the idea of making decisions in code through the careful
- * use of booleans. We can ask our code a question and how a course of action
- * laidout for the 2-3 possible answers given such a situation.
- * My tools of choice for control flow are if, elseif, else statements.
- * In each statement it boils down to which statement will come true? So that
- * the code linked to the statement may run. Again I'll be sharing examples
- * of some of my work I've completed related to the study.
- */
- var thisGuy = {
- eyes: "brown",
- age: 21,
- name: "Taijon",
- };
- function isObject(value) {
- if (null === value) return false;
- else if (Array.isArray(value)) return false;
- else if (value instanceof Date) return false;
- else if (typeof value === "object") return true;
- else return false;
- }
- console.log(isObject([])); //prints false. [] an array does not pass the test
- //being an object.
- console.log(isObject(thisGuy));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement