Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="description" content="DataTypes">
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>JS Bin</title>
- </head>
- <body>
- <script id="jsbin-javascript">
- /*
- DATA TYPES.
- Data Types are the key information that we feed our programs. They give us
- the ability to describe real-world objects and solve real-world problems.
- JS Data Types are Dynamic which means that the same variable can be used to
- hold different Data Types.
- SIMPLE/Primitive Data Types that are used/manipulated are:
- Numbers = Numerical Data
- Strings = Character-based Data
- Booleans = Evaluate to TRUE/FALSE
- NaN = 'Not a Number'
- undefined = No-value, Unassigned. Any variable can be emptied or undefined
- null = No-value, Nothing. Any object can be emptied & assigned to null
- Infinity = property of the global object whose numeric value = infinity
- *These Data Types are immutable. They copy by Value.
- COMPLEX Data Types are collections of simple Data Types:
- Arrays = single variables with multiple values aka objects with values
- referenced by number or indices
- Objects = complex collections of properties aka key-value pairs. These
- key-value pairs are referenced rather than numbered indices
- Functions = blocks of code designed to perform particular tasks. Functions
- manipulate all data types and collections to give life & purpose to our programs.
- *These Data Types are mutable. They hold value by reference
- DATA TYPES EX: interplay between protagonist/antagonist from my fav anime(=
- */
- nameGivenToLight = true;
- seenLight = true;
- let protagonist = {
- name: 'Light Yagami',
- alias: 'Kira',
- anime: 'Death Note',
- shinigami: false,
- killMethod: function() {
- if(nameGivenToLight === true && seenLight === true) {
- var status = "Now " + antagonist.alias + " is dead.";
- console.log(status);
- } else {
- Console.log("Still breathing");
- }
- }
- };
- let antagonist = {
- name: 'L. Lawliet',
- alias: 'L',
- anime: 'Death Note',
- shinigami: false
- };
- protagonist.killMethod(); //Logs "Now L is dead."
- </script>
- <script id="jsbin-source-javascript" type="text/javascript">/*
- DATA TYPES.
- Data Types are the key information that we feed our programs. They give us
- the ability to describe real-world objects and solve real-world problems.
- JS Data Types are Dynamic which means that the same variable can be used to
- hold different Data Types.
- SIMPLE/Primitive Data Types that are used/manipulated are:
- Numbers = Numerical Data
- Strings = Character-based Data
- Booleans = Evaluate to TRUE/FALSE
- NaN = 'Not a Number'
- undefined = No-value, Unassigned. Any variable can be emptied or undefined
- null = No-value, Nothing. Any object can be emptied & assigned to null
- Infinity = property of the global object whose numeric value = infinity
- *These Data Types are immutable. They copy by Value.
- COMPLEX Data Types are collections of simple Data Types:
- Arrays = single variables with multiple values aka objects with values
- referenced by number or indices
- Objects = complex collections of properties aka key-value pairs. These
- key-value pairs are referenced rather than numbered indices
- Functions = blocks of code designed to perform particular tasks. Functions
- manipulate all data types and collections to give life & purpose to our programs.
- *These Data Types are mutable. They hold value by reference
- DATA TYPES EX: interplay between protagonist/antagonist from my fav anime(=
- */
- nameGivenToLight = true;
- seenLight = true;
- let protagonist = {
- name: 'Light Yagami',
- alias: 'Kira',
- anime: 'Death Note',
- shinigami: false,
- killMethod: function() {
- if(nameGivenToLight === true && seenLight === true) {
- var status = "Now " + antagonist.alias + " is dead.";
- console.log(status);
- } else {
- Console.log("Still breathing");
- }
- }
- };
- let antagonist = {
- name: 'L. Lawliet',
- alias: 'L',
- anime: 'Death Note',
- shinigami: false
- };
- protagonist.killMethod(); //Logs "Now L is dead."
- </script></body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement