| | #1 |
| MagicLouieServices.com War Room Member Join Date: 2010 Location: Pearl of the Orient Seas, Philippines
Posts: 1,275
Thanks: 312
Thanked 526 Times in 365 Posts
Blog Entries: 2 |
Hello Fellow Warriors, In JavaScript's document.createElement('div'), is 'div' a parameter or an argument? While checking https://developer.mozilla.org/en-US/.../createElement, I noticed the section titled "Parameters." However, upon further research, I found other resources referring to it as "arguments." In the context of function calls in JavaScript, 'div' is an argument. You pass this string to specify the type of element you want to create. It is not considered a parameter when you are calling the createElement method. For instance, in document.createElement('div'), 'div' is the argument you provide to create a <div> element. Thanks a lot. |
| |
| | #2 |
| Midnight Oil Warrior Join Date: 2013 Location: Bridgeport, WV.
Posts: 6,796
Thanks: 3,622
Thanked 6,636 Times in 3,502 Posts
|
to be honest i dont consider div to be either a Parameter or an Argument, its simply a division element that divides the html tag. Yeah you can alter the tag... but you are then introducing "decorateDiv(div)" or the like, and its really not the same thing A div is just that, a div... even in the case of a defined decorate div... its still a div |
| Success is an ACT not an idea | |
| |
| | #3 |
| Active Warrior Join Date: 2022
Posts: 32
Thanks: 2
Thanked 26 Times in 13 Posts
|
In other languages there is also a case like this, for example a class object can be an object and also a parameter to another object, so if I'm not wrong you simply need to see the context and different elements can take on different roles, that is why modern programming is so powerfull and versatile
|
| |
| | #4 |
| New Warrior Member Join Date: 2024
Posts: 3
Thanks: 0
Thanked 1 Time in 1 Post
|
In JavaScript, `div` is an argument when passed to the `document.createElement` method. Here's the breakdown: - **Parameter**: This is a variable in the declaration of the function. In the case of `document.createElement`, the parameter is the element type to create. - **Argument**: This is the actual value passed to the function when it is called. When you use `document.createElement('div')`, the string `'div'` is the argument. Example: ```javascript // Calling the method with 'div' as an argument let myDiv = document.createElement('div'); ``` In this case, `'div'` is the argument provided to the `document.createElement` method. |
| |
| The Following User Says Thank You to Meshii Mahi For This Useful Post: |
|
| Bookmarks |
| Tags |
| argument, div, documentcreateelement, javascript, method, parameter |
| Thread Tools | Search this Thread |
| |