functions
-
I created a simple function Greet (), What goes inside the ()? If I leave it blank, when I call the function it works great. If I put something inside then it stops working altogether, even when I put the same thing inside. I'm happy it worked, but I'm very new to this and want to understand fully the basics. Thank you so much for your help!
-
I created a simple function Greet (), What goes inside the ()? If I leave it blank, when I call the function it works great. If I put something inside then it stops working altogether, even when I put the same thing inside. I'm happy it worked, but I'm very new to this and want to understand fully the basics. Thank you so much for your help!
These links can give you an overview about JavaScript functions basics:
-
I created a simple function Greet (), What goes inside the ()? If I leave it blank, when I call the function it works great. If I put something inside then it stops working altogether, even when I put the same thing inside. I'm happy it worked, but I'm very new to this and want to understand fully the basics. Thank you so much for your help!
I just learned this myself. When you define your function Greet(), you need to define it with something inside the parenthesis so the function expects to get data to then be used in the function. So you would define Greet() instead as Greet(var). In this case var is any variable name you choose. Greet can then use var in the function for whatever purposes it needs. When you call Greet, you would put a string or other variable name inside the parenthesis: Greet("Sue") or Greet(namex). The function will then treat that as var. :cool:Hope that was clear enough to help!