Skip to content

Commit a6b06ef

Browse files
save file
1 parent 6c68663 commit a6b06ef

File tree

1 file changed

+73
-68
lines changed

1 file changed

+73
-68
lines changed

blog/25-08-07/determine-datatypes-in-javascript/determine-datatypes-in-javascript.html

Lines changed: 73 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55

66
<head>
77
<meta charset=utf-8>
8-
8+
99
<title>
1010
Determine Datatypes In Javascript
1111
</title>
12-
12+
1313
<meta name=description content='Learn how to determine data types in JavaScript. Explore interactive, editable code examples that let you test and understand type detection in real time.'>
1414
<link rel=icon type='image/png' href='/blog/image/blog-30.png'>
1515
<meta name=viewport content='width=device-width, initial-scale=1'>
16-
16+
1717
<base href='https://ext-code.com/blog/25-08-07/determine-datatypes-in-javascript/'>
1818
<link rel=canonical href='https://ext-code.com/blog/25-08-07/determine-datatypes-in-javascript/determine-datatypes-in-javascript.html'>
1919

20-
21-
<script type='application/ld+json'>
20+
21+
<script type='application/ld+json'>
2222
{
2323
"@context" : "https://schema.org",
2424
"@type" : "TechArticle",
@@ -29,7 +29,7 @@
2929
"dateModified" : "2025-10-29",
3030
"mainEntityOfPage" : {"@type":"WebPage","@id":"https://ext-code.com/blog/25-08-07/determine-datatypes-in-javascript/determine-datatypes-in-javascript.html"},
3131
"publisher" : {"@type":"Organization","name":"Your Blog or Company Name","logo":{"@type":"ImageObject","url":"https://ext-code.com/favicon.ico"}},
32-
}
32+
}
3333
</script>
3434
<!--
3535
"image" : "https://yourdomain.com/images/http2-nodejs-demo.png"
@@ -42,22 +42,22 @@
4242

4343

4444
<script src='https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js'></script>
45-
46-
45+
46+
4747
<script src='https://libs.ext-code.com/js/dom/component/component.js'></script>
48-
49-
48+
49+
5050
<script init>
5151
console.clear();
5252
console.log('determine-datatypes-in-javascript.html');
5353
console.log();
5454
console.json=v=>console.log(JSON.stringify(v,null,4));
5555
var df=true,version='v2.0'
5656
;
57-
58-
57+
58+
5959
var ace;
60-
60+
6161
var ext;
6262
var $;
6363
var datatype;
@@ -70,19 +70,19 @@
7070
var ex2;
7171
var ex3;
7272
var log;
73-
73+
7474

7575
//:
76-
77-
76+
77+
7878
async function init(){
7979
debug('init',version);
8080
menu = menumod();
81-
81+
8282
mod.base.add({ext,$,datatype,keydown,menu,menumod,ace});
8383

84-
85-
hdr = mod['blog-hdr'];
84+
85+
hdr = mod['blog-hdr'];
8686
ex1 = mod.ex1;
8787
ex2 = mod.ex2;
8888
ex3 = mod.ex3;
@@ -104,17 +104,17 @@
104104

105105

106106
initdom(document.body);
107-
108-
107+
108+
109109
}//init
110-
111-
110+
111+
112112
(async()=>{
113113

114114
mod.stack.add;
115115

116116
({ext} = await import('https://libs.ext-code.com/js/io/ext-loader/ext-loader.m.js'));
117-
117+
118118
var promise = ext.load.libs(
119119
'js/dom/$.js',
120120
'js/core/datatype.js',
@@ -123,15 +123,15 @@
123123
'js/debug/debug.js',
124124
);
125125
[$,datatype,menumod,keydown,debug] = await promise;
126-
126+
127127
mod.stack.complete;
128-
128+
129129
})();
130130

131-
132-
</script init>
133-
134131

132+
</script init>
133+
134+
135135
<style>
136136

137137
html
@@ -146,40 +146,40 @@
146146
[component]
147147
{display:none}
148148

149-
.description
149+
.description
150150
{max-width:1000px;text-align:justify;border-left:4px solid #4a90e2;padding:1rem 2rem;
151151
background-color:#f9f9f9;font-family:system-ui,sans-serif;font-size:1rem;line-height:1.6;color:#333}
152152
.description>p
153153
{margin:0}
154154
.description > p+p
155155
{margin:10px 0}
156-
156+
157157
code
158158
{font-family:monospace;background:whitesmoke}
159159
code.inline
160160
{display:inline;padding:5px 10px}
161-
161+
162162
a
163163
{color:#4a90e2;text-decoration:none;font-weight:500}
164-
a:hover
164+
a:hover
165165
{text-decoration:underline}
166166
.link-domain
167167
{font-size:0.85rem;color:#777;margin-left:0.25rem}
168-
.link-domain::before
168+
.link-domain::before
169169
{content:'['}
170170
.link-domain::after
171171
{content:']'}
172172
.link-txt
173173
{}
174-
174+
175175
input
176176
{font-size:16px;padding:5px 7px;box-sizing:border-box;}
177177
input[type=button]
178178
{cursor:pointer}
179-
180-
181-
182-
179+
180+
181+
182+
183183

184184
h3
185185
{text-align:center;color:blue}
@@ -200,96 +200,101 @@
200200

201201

202202
</style>
203-
203+
204204
</head>
205205

206206

207207
<body>
208-
209-
210-
<blog-hdr component=grp1>
208+
209+
210+
<blog-hdr component=grp1>
211211
<h1 class=title>
212212
Determine Datatypes In Javascript
213213
</h1>
214214
<time slot=date datetime=2025-10-29>
215215
29 Oct 2025
216216
</time>
217217
</blog-hdr>
218-
218+
219219
<div class=description>
220220
<p>
221221
Learn how to determine data types in JavaScript. Explore interactive, editable code examples that let you test and understand type detection in real time.
222222
</p>
223223
</div>
224-
224+
225225
<div class=description>
226226
Determining datatypes in javascript always seemed to be a bit of a mystery, I've seen hundreds
227-
of incarnations over the years, some work in some circumstances, until the code starts to get more
227+
of incarnations over the years, some work in some circumstances, until the code starts to get more
228228
complex and then just mysteriously stop working, my go to for datatype has always been the following :
229229
</div>
230-
230+
231231
<snippet-console id=ex1 src='ex/ex1.js' component></snippet-console>
232-
233-
232+
233+
234234
<div class=break></div>
235235

236236

237237
<div>
238238
This can be extended further through the use of
239+
<br>
240+
<b>
241+
datatype
242+
</b>
243+
given here as a one liner
239244
</div>
240245

241246
<snippet-console id=ex2 src='ex/ex2.js' component></snippet-console>
242247

243-
244-
<div class=break></div>
245-
246-
248+
249+
<div class=break></div>
250+
251+
247252
<div>
248-
Instanceof is unreliable in the follow scenario
253+
Instanceof is unreliable in common scenarios
249254
</div>
250255

251256
<snippet-console id=ex3 src='ex/ex3.js' component></snippet-console>
252-
253-
257+
258+
254259
<log-mod component></log-mod>
255260

256261

257-
</body>
262+
</body>
258263

259264

260265
<!-- ----- -->
261266

262267

263268
<script>
264-
265-
266-
269+
270+
271+
267272
//:
268273

269274

270275
function initdom(rootnode){
271-
272-
276+
277+
273278
root = rootnode;
274-
279+
275280
hdr.initdom();
276281
ex1.initdom();
277282
ex2.initdom();
278283
ex3.initdom();
279284

280285

281286
log.initdom();
282-
283-
284-
}//initdom
285287

286-
288+
289+
}//initdom
290+
291+
287292
//:
288293

289294

290295

291296

292-
297+
293298
</script>
294299

295300

0 commit comments

Comments
 (0)