Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,194,200 members, 7,953,742 topics. Date: Friday, 20 September 2024 at 02:25 AM

Let's Learn Javascript - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Let's Learn Javascript (889 Views)

Learn Javascript Here!!!(updated) / I Want To Learn Javascript And Css / Let's Learn PHP (2) (3) (4)

(1) (Reply) (Go Down)

Let's Learn Javascript by tunddy(m): 10:34pm On Dec 05, 2015
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>java script</title>
</head>

<body>

<h1 id="demo"></h1>
<script>
document.getElementById("demo"wink.innerHTML="welcome to the world of javascript";
</script>

</body>
</html>
Re: Let's Learn Javascript by hollyfat(m): 10:59pm On Dec 05, 2015
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>java script</title>
</head>

<body>

<script type="text/javascript">
var a = confirm("Are you sure you want to learn javascript?"wink;

if(a == true){
window.alert("Welcome to javascript"wink;
}
</script>

</body>
</html>
Re: Let's Learn Javascript by tunddy(m): 10:31am On Dec 06, 2015
what type of data type is var a ?
Re: Let's Learn Javascript by hollyfat(m): 10:59am On Dec 06, 2015
tunddy:
what type of data type is var a ?
var is used to declare variable in javascript, while a is the variable name. In this case, a is a Boolean data type
Re: Let's Learn Javascript by tunddy(m): 11:08am On Dec 06, 2015
okie what type of data type is "confirm("Are you sure you want to learn javascript?);"
Re: Let's Learn Javascript by hollyfat(m): 11:25am On Dec 06, 2015
tunddy:
okie what type of data type is "confirm("Are you sure you want to learn javascript?);"

Confirm() is a method, it's neither a variable nor a data type
Re: Let's Learn Javascript by Adesege(m): 12:02pm On Dec 06, 2015
What tunddy meant is or should have been, after declaring a variable, do one need to cast it to a specific type or does one need to declare the type also.

No, tunddy.

You cannot declare a type for a variable but you can cast the value to a specific type.

Take for example,

var zee.

Depending on how you use the variable zee, it can take any type.

Zee can be of a boolean type, string type, int type, float type, etc.

But if you want to get a particular type, you can cast it.

For example,

zee='10' is different from zee=10. The first is of string type while the latter is an integer but you can cast the former into an interger by

zee=parseInt(zee);
This will change the type from string to integer.

Hope that helps.

Cheers,
Adesege
Re: Let's Learn Javascript by Adesege(m): 12:06pm On Dec 06, 2015
hollyfat:


Confirm() is a method, it's neither a variable nor a data type

While you are right that confirm() is a method, it can return any type. So it doesn't restrict it to boolean alone, as some believes.

Cheers,
Adesege
Re: Let's Learn Javascript by hollyfat(m): 1:13pm On Dec 06, 2015
Adesege:


While you are right that confirm() is a method, it can return any type. So it doesn't restrict it to boolean alone, as some believes.

Cheers,
Adesege

confirm() return either true or false. It's prompt() method that can return any data type
Re: Let's Learn Javascript by Adesege(m): 3:06pm On Dec 06, 2015
hollyfat:


confirm() return either true or false. It's prompt() method that can return any data type

Oh!!! I wanted to say that a method can return any type, not necessarily boolean type.

Thanks
Re: Let's Learn Javascript by tunddy(m): 2:29pm On Dec 09, 2015
bros i have got to know that the "alert()" is a function and not a data type
Re: Let's Learn Javascript by Adesege(m): 6:53pm On Dec 09, 2015
tunddy:
bros i have got to know that the "alert()" is a function and not a data type

Well if you are referring to my post about a method returning any data type, then I will say we are saying the same thing.

A method is also a function. A function can return any data type not necessarily boolean data type.

Data types maybe string, integer, null, true, false, etc
Re: Let's Learn Javascript by tunddy(m): 10:49am On Dec 11, 2015
okie i get.......let's talk about "function()" what is a function?

(1) (Reply)

Powerful Webcam Enabled Social Network For Just 50k! / Disregard Cbn's Policy - New Ways To Pay For Your Hosting & Domains In USD / PHP 7.0.0 On The Table Officially

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 14
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.