Skip to content

Commit e2a7599

Browse files
committed
update primitive types
1 parent 81874c9 commit e2a7599

File tree

11 files changed

+1024
-209
lines changed

11 files changed

+1024
-209
lines changed

01-Reteaching-JavaScript/02-LearnTerminalWithGitPod/readme.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ autoSlideStoppable: true
2222
<link rel="stylesheet" href="https://raw.githubusercontent.com/HansUXdev/JavaScript-First/master/theme.css">
2323
<style>
2424
/* .line.focus{background:none;font-size: xx-large;color: #5cc4ea;}
25-
.reveal ul{ margin:0 !important;}
2625
.line.focus{background:none;font-size: xx-large;color: #5cc4ea;}
2726
2827
.flex-slide{display:flex}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const vObjectObj = {property: "Value"}
2+
const vArrayObject = [1, 2.1, "string"]
3+
4+
function LOGobject(VAR){
5+
if( VAR !==null && typeof VAR === "object") {
6+
console.log(`type: ${VAR}
7+
frozen: ${Object.isFrozen(VAR)}
8+
sealed: ${Object.isSealed(VAR)}
9+
data:
10+
${JSON.stringify(VAR)}
11+
`)
12+
}
13+
if ( Array.isArray(VAR) ) console.log("\n Object is an Array: ", typeof VAR, "\n Value: ",VAR);
14+
}
15+
16+
LOGobject(vObjectObj);
17+
LOGobject(vArrayObject);

01-Reteaching-JavaScript/05-logging-datatype/code/logTern.js

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,17 @@
1-
const LOGexplained = (VAR) => {
2-
const LOG = console.log;
3-
(
4-
typeof VAR==="string" || typeof VAR==="number" ||
5-
typeof VAR==="boolean"||typeof VAR==="symbol" ||
6-
typeof VAR==="bigint"
7-
&& typeof VAR !=="object" && VAR !==null && VAR !==undefined
8-
) ?
9-
LOG("\n PRIMITIVE: ", typeof VAR, "\n Value: ",VAR)
10-
:
11-
( Array.isArray(VAR) ) ?
12-
LOG(`type: Array Object,
13-
data:
14-
`)& console.table(VAR)
15-
:
16-
(VAR !==null && typeof VAR === "object") ?
17-
LOG(`type: ${VAR}
18-
frozen: ${Object.isFrozen(VAR)}
19-
sealed: ${Object.isSealed(VAR)}
20-
data:
21-
${JSON.stringify(VAR)}
22-
`)
23-
:
24-
(typeof VAR === "function") ?
25-
LOG(`type: ${VAR},
26-
frozen: ${Object.isFrozen(VAR)},
27-
sealed: ${Object.isSealed(VAR)}
28-
`)
29-
:
30-
(VAR===null) ?
31-
LOG("\n must be null: ", "'",typeof VAR,"'")
32-
:
33-
LOG("\n must be undefined... \n");
34-
}
1+
let vUndefined;
2+
const vNull = null;
3+
4+
const vString = "some text";
5+
const vNumber = 10;
6+
const vBoolean = false;
7+
const vSymbol = Symbol('foo');
8+
const vBigInt = BigInt(9007199254740991);
9+
10+
const vObjectObj = {property: "Value"}
11+
const vArrayObject = [1, 2.1, "string"]
12+
function functionObject(params) {}
13+
async function functionAsync(params) {}
14+
class ClassObj {}
3515

3616

3717
const LOG = (VAR) => {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const vNull = null;
2+
const vObjectObj = {property: "Value"}
3+
const vArrayObject = [1, 2.1, "string"]
4+
5+
function LOGnull(VAR){
6+
if(VAR===null){
7+
return console.log(`
8+
Value: ${VAR}
9+
Typeof: ${typeof VAR}
10+
===: ${VAR===null}
11+
`)
12+
}
13+
else{ return false, console.log("Not NULL !") }
14+
}
15+
// LOGnull(vNull);
16+
LOGnull(vObjectObj);
17+
// LOGnull(vArrayObject);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
=
1+
${VAR===null}

01-Reteaching-JavaScript/05-logging-datatype/export/index.html

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<head>
55
<meta charset="utf-8">
66

7-
<title>log</title>
7+
<title>Logging JavaScript Datatypes</title>
88

99
<meta name="description" content="">
1010
<meta name="author" content="">
@@ -96,7 +96,7 @@
9696

9797
<!-- Theme used for syntax highlighting of code -->
9898

99-
<link rel="stylesheet" href="libs/highlight.js/9.12.0/monokai.css">
99+
<link rel="stylesheet" href="libs/highlight.js/9.12.0/Monokai.css">
100100

101101

102102

@@ -279,30 +279,51 @@
279279

280280
<section >
281281

282-
<style>
283-
.line.focus{background:none;font-size: xx-large;color: #5cc4ea;}
284-
.reveal ul{ margin:0 !important;}
285-
.line.focus{background:none;font-size: xx-large;color: #5cc4ea;}
286-
287-
.flex-slide{display:flex}
288-
.column {display: flex;
289-
flex-direction: column;
290-
flex-basis: 100%;
291-
flex: 4;
282+
<link rel='stylesheet' href='theme.css'>
283+
<style>
284+
</style>
285+
<h3><a id="user-content-excercise-1-logging-primitive-types" class="anchor" href="#excercise-1-logging-primitive-types" aria-hidden="true"></a>Excercise 1: Logging Primitive Types</h3>
286+
<p class="fragment">Step 1: Inside <code>0-student_files/chp1/primitives.js</code> type the following code </p>
287+
<pre><code class="language-javascript">let vUndefined;
288+
const vNull = null;
289+
290+
const vString = &quot;some text&quot;;
291+
const vNumber = 10;
292+
const vBoolean = false;
293+
const vSymbol = Symbol('foo');
294+
const vBigInt = BigInt(9007199254740991);
295+
296+
function LOGprimitive(VAR){
297+
if (typeof VAR !==&quot;object&quot; &amp;&amp; VAR !==&quot;function&quot; &amp;&amp; VAR !==null &amp;&amp; VAR !==undefined)
298+
{
299+
return console.log(&quot;\n PRIMITIVE: &quot;, typeof VAR, &quot;\n Value: &quot;,VAR);
300+
}
301+
return console.log(&quot;\n NOT PRIMITIVE..&quot;)
292302
}
293303

294-
.double-column {
295-
display: flex;
296-
flex-direction: column;
297-
flex-basis: 100%;
298-
flex: 1;
299-
}
300-
.present {}
301-
.flex-slide p.fragment{ font-size: 0.6em; }
304+
LOGprimitive(vUndefined)
305+
LOGprimitive(vNull)
302306

303-
h1, h2, h3, h4, h5, h6, p {color:white;}
304-
</style>
305-
<h1><a id="user-content-logging-datatypes" class="anchor" href="#logging-datatypes" aria-hidden="true"></a>Logging Datatypes</h1>
307+
LOGprimitive(vString)
308+
LOGprimitive(vNumber)
309+
LOGprimitive(vBoolean)
310+
LOGprimitive(vSymbol)
311+
LOGprimitive(vBigInt)
312+
313+
</code></pre>
314+
<p class="fragment current-only" data-code-focus="1-9">Step 2: Define what a variable for each <strong>primitate</strong> type.</p>
315+
<p class="fragment current-only" data-code-focus="10-16">Step 2: create something a <strong>function</strong> called <code>LOGprimitive</code> that uses a conditional statement and the typeof operator to determine if the variable is a primitive type</p>
316+
<p>Step 3: Here we are using a <strong>conditional if statement</strong> refers to cs-h</p>
317+
318+
</section>
319+
320+
321+
322+
323+
324+
<section >
325+
326+
<h1><a id="user-content-logging-datatypes" class="anchor" href="#logging-datatypes" aria-hidden="true"></a>Logging Datatypes</h1>
306327
<p>This section is still in progress…</p>
307328
<h3><a id="user-content-learning-objectives" class="anchor" href="#learning-objectives" aria-hidden="true"></a>Learning Objectives</h3>
308329
<ol>
@@ -348,7 +369,7 @@ <h3><a id="user-content-learning-objectives" class="anchor" href="#learning-obje
348369
help: true,
349370
showNotes: false,
350371
autoPlayMedia: false,
351-
autoSlide: 5000,
372+
autoSlide: 50000,
352373
autoSlideStoppable: true,
353374
autoSlideMethod: Reveal.navigateNext,
354375
defaultTiming: 120,

01-Reteaching-JavaScript/05-logging-datatype/readme.md

Lines changed: 54 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,71 @@
11
---
22
# This file is best viewed in vscode using vscode-reveal
33
# https://marketplace.visualstudio.com/items?itemName=evilz.vscode-reveal
4-
title: "log"
4+
title: "Logging JavaScript Datatypes"
55
logoImg: "https://raw.githubusercontent.com/HansUXdev/JavaScript-First/2acf5840c15af96602aceb66303ea69c5b75e344/logo.svg"
6-
theme : "night"
7-
transition: "slide"
8-
highlightTheme: "monokai"
9-
slideNumber: true
10-
loop: true
11-
autoSlide: 5000
6+
theme: "night"
7+
highlightTheme: "Monokai"
8+
#transition: " slide "
9+
#transitionSpeed: " default "
10+
#slideNumber: true
11+
#loop: true
12+
#autoSlide: 5000
1213
# openButton: false
13-
enableMenu: false
14+
#enableMenu: false
1415
# controlsLayout: 'edges'
1516
# controls: true
16-
enableChalkboard: false
17+
#enableChalkboard: false
1718
# enableTitleFooter: false
18-
autoSlideStoppable: true
19+
#autoSlideStoppable: true
1920
---
2021

22+
<link rel='stylesheet' href='theme.css'>
2123
<style>
22-
.line.focus{background:none;font-size: xx-large;color: #5cc4ea;}
23-
.reveal ul{ margin:0 !important;}
24-
.line.focus{background:none;font-size: xx-large;color: #5cc4ea;}
25-
26-
.flex-slide{display:flex}
27-
.column {display: flex;
28-
flex-direction: column;
29-
flex-basis: 100%;
30-
flex: 4;
31-
}
24+
</style>
25+
26+
3227

33-
.double-column {
34-
display: flex;
35-
flex-direction: column;
36-
flex-basis: 100%;
37-
flex: 1;
28+
### Excercise 1: Logging Primitive Types
29+
Step 1: Inside `0-student_files/chp1/primitives.js` type the following code {.fragment}
30+
31+
```javascript
32+
let vUndefined;
33+
const vNull = null;
34+
35+
const vString = "some text";
36+
const vNumber = 10;
37+
const vBoolean = false;
38+
const vSymbol = Symbol('foo');
39+
const vBigInt = BigInt(9007199254740991);
40+
41+
function LOGprimitive(VAR){
42+
if (typeof VAR !=="object" && VAR !=="function" && VAR !==null && VAR !==undefined)
43+
{
44+
return console.log("\n PRIMITIVE: ", typeof VAR, "\n Value: ",VAR);
45+
}
46+
return console.log("\n NOT PRIMITIVE..")
3847
}
39-
.present {}
40-
.flex-slide p.fragment{ font-size: 0.6em; }
4148

42-
h1, h2, h3, h4, h5, h6, p {color:white;}
43-
</style>
49+
LOGprimitive(vUndefined)
50+
LOGprimitive(vNull)
51+
52+
LOGprimitive(vString)
53+
LOGprimitive(vNumber)
54+
LOGprimitive(vBoolean)
55+
LOGprimitive(vSymbol)
56+
LOGprimitive(vBigInt)
57+
58+
```
59+
Step 2: Define what a variable for each **primitate** type. {.fragment .current-only data-code-focus=1-9 }
60+
61+
Step 2: create something a **function** called `LOGprimitive` that uses a conditional statement and the typeof operator to determine if the variable is a primitive type {.fragment .current-only data-code-focus=10-16 }
62+
63+
Step 3: Here we are using a **conditional if statement** refers to cs-h
64+
65+
66+
---
67+
68+
4469

4570

4671
# Logging Datatypes

0 commit comments

Comments
 (0)