0

I m learning javascript. When I write js. Codes on notepad it doesn't work. Why? Plz help!

20th Jun 2020, 3:09 PM
Alian Jutt
Alian Jutt - avatar
7 Antworten
+ 3
Alian Jutt document is an object and write is a function. Object never start with capital letters so here Document will be wrong. we call function from the object using dot (.) operator so there should not be space before the dot (.) operator. So document. write is wrong because there is space before dot operator. document. write //wrong (it will work but wrong calling) document.write //right
20th Jun 2020, 3:35 PM
A͢J
A͢J - avatar
+ 2
<script> document.write("Hello World!"); </script>
20th Jun 2020, 3:27 PM
Sivaprasad
+ 1
Alian Jutt String value should be in double quotes " " document.write(Hello) // wrong, here Hello will be consider as variable document.write("Hello") //right, here Hello will be consider as String
20th Jun 2020, 3:30 PM
A͢J
A͢J - avatar
+ 1
Thanks AJ Anant you are genious
20th Jun 2020, 3:37 PM
Alian Jutt
Alian Jutt - avatar
0
Alian Jutt Where is your Code? How did you write?
20th Jun 2020, 3:16 PM
A͢J
A͢J - avatar
0
I write Document. write(Hello) As told by this app.
20th Jun 2020, 3:17 PM
Alian Jutt
Alian Jutt - avatar
0
Thanks dear
20th Jun 2020, 3:27 PM
Alian Jutt
Alian Jutt - avatar