Learn JavaScript TYPE CONVERSION in 5 minutes! 💱

preview_player
Показать описание
// type conversion = change the datatype of a value to another
// (strings, numbers, booleans)

// --------------- EXAMPLE 1 ---------------
age = Number(age);
age+=1;

// --------------- EXAMPLE 2 ---------------
let x = "pizza";
let y = "pizza";
let z = "pizza";

x = Number(x);
y = String(y);
z = Boolean(z);

Рекомендации по теме
Комментарии
Автор

// type conversion = change the datatype of a value to another
// (strings, numbers, booleans)

// EXAMPLE 1
let age = window.prompt("How old are you?");
age = Number(age);
age+=1;

console.log(age, typeof age);

// EXAMPLE 2
let x = "pizza";
let y = "pizza";
let z = "pizza";

x = Number(x);
y = String(y);
z = Boolean(z);

console.log(x, typeof x);
console.log(y, typeof y);
console.log(z, typeof z);

BroCodez
Автор

His teaching skill is outstanding. I learn most of programming from his tutorial.☺

filsjvr
Автор

<*_> This is my seal. I have watched the entire video, understood it, and I can explain it in my own words, thus I have gained knowledge. This is my seal. <_*>

piotrmazgaj
Автор

i remembered it now! you sound like "lets game it out" youtuber! haha

ezekielsayson
Автор

this is what is different in these lessons than all the other people and posts I've come across teaching JS.

Why

this is what bugs me. they don't tell me Why I would be doing this or that. they don't show me where I could use any of these things. examples and reasons, so very important for me to understand complex concepts .

I can't just drone-like take in and memorise everything a lesson giver tells me if I don't know what I can use it for.

navtektv
Автор

if i itterate the age value with age++ instead of age+=1 its type is converted into number, even if i don't have to use age=Number(age). Interesting!

ghostvamp
Автор

Kinda funny how "Not a Number" NaN returns as a number.

Sarkkoth
Автор

bro any difference between his 12 hr full course and playlist

muhammedanas
Автор

So did i miss something or how do i convert a boolean to a string?

mozy
Автор

Can we do this? Declaration let varName = number (1);

florentd.
visit shbcf.ru