Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. functions

functions

Scheduled Pinned Locked Moved JavaScript
helpquestion
3 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 11803394
    wrote on last edited by
    #1

    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!

    S U 2 Replies Last reply
    0
    • U User 11803394

      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!

      S Offline
      S Offline
      Shmuel Zang
      wrote on last edited by
      #2

      These links can give you an overview about JavaScript functions basics:

      • http://www.w3schools.com/js/js_functions.asp
      • http://www.w3schools.com/js/js_function_definition.asp
      • http://www.w3schools.com/js/js_function_parameters.asp
      • http://www.w3schools.com/js/js_function_invocation.asp
      1 Reply Last reply
      0
      • U User 11803394

        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!

        U Offline
        U Offline
        User 11814397
        wrote on last edited by
        #3

        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!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups