Stats: 3,236,746 members, 8,103,107 topics. Date: Thursday, 13 March 2025 at 07:11 AM |
Nairaland Forum / Science/Technology / Webmasters / Let's Learn Javascript (937 Views)
Learn Javascript Here!!!(updated) / I Want To Learn Javascript And Css / Let's Learn PHP (2) (3) (4)
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" ![]() </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?" ![]() if(a == true){ window.alert("Welcome to javascript" ![]() } </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: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: 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: 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: 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: 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: 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)
Get Upto 10k Traffic To Your Website Via Growtraffic.com / efwfwfw / Install Mmm Php Script
(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 - 2025 Oluwaseun Osewa. All rights reserved. See How To Advertise. 17 |