javascriptstatements

understanding the use of javascript statements


This question is not meant to find a solution for the task but to understand as the title says. I could not categorize the question. Without further ado. I began practicing Javascript on the website freecodecamp.org.My main concern is the set up of the function from freecodecamp.org:

for ([initialization]; [condition]; [final-expression])

Keep in mind that all these three are statements. So when I dug deeper the website w3schools.com stated that:

JavaScript statements are composed of:Values, Operators, Expressions, Keywords, and Comments.

The for loop has the following syntax:
for (statement 1; statement 2; statement 3) {
  // code block to be executed
}

w3schools.com displays strings as statements. My questions are: - Does that mean Objects can also become statements? (Since values are considered to be statements, I am referring to the Name-Value-pairs). - How are statements and parameters connected with each other? (since both are 'value-holders')


Solution

  • Does that mean Objects can also become statements?

    The answer to that is no.

    I get what you mean: Of course you can use objects to achieve "statement/operator-like meaning" within a programming language, but these properties only exist in semantics and do not become part of the syntax as actual statements or operators of the language.

    There is actually a big difference between syntax and semantics when it comes to the inner logic programming languages. I don't want to dig deeper in it because that would be a bit off-topic for Stack Overflow and I'm also not an expert in Computer Science.