Both programming languages use variables. Though, in JavaScript, they always begin with ”var,” whilst in Python, a statement before the variable name is not needed.
In JavaScript, function declarations are also expressions and can be anonymous; the function name can be omitted. This allows a few interesting uses that Python does not have, because in Python, functions cannot be anonymous, and are not expressions, so they cannot be defined and used on the same line.
When using Python, strings can contain letters, numbers, and symbols; they must be enclosed within quotation marks, and when using an apostrophe, you must put a blackslash before, so the rest of the string isn't messed up. In JavaScript, you cannot use only quotation marks, because then the computer will assume that is a variable. Instead, you must put it within the “text” statement and include it within parenthesis, which is then followed by the x and y position of the text.
In JavaScript, there are three brackets used, which are { }, ( ), and [ ]. The curly brackets are used to define the start and end of the function. They also separate code into blocks within the function. The [ ] brackets are used for arrays, and the standard parenthesis, ( ), is used for when parameters are either sent or received. And in Python, curly brackets create either dictionaries or sets, whilst square, [ ], brackets create lists. And like in JavaScript, ( ) are just the basic bracket type.
When using JavaScript, a variable assignment is also an expression that returns the value assigned. Though in Python, you must be careful when writing assignments to use the single “=,” as the double “==,” sign is what conveys equality in an equation.