Javascript Comments: // This line will denote a comment
Javascript Comparison Operators: == equal to != not equal > greater than < less than >= less than or equal to
Javascript String: let text = "HELLO WORLD";
Javascript String Concatenation: let displayText = 'Your ' + service + ' bill is due on ' + month + '.';
No semicolons needed to represent the end of a statement :)
Javascript Booleans: let x = 0; Boolean(x);
# Comment on a single line
def my_function(): print("Hello from a function") my_function()
Javascript Variables: var x = 5; var y = 6; var z = x + y;
Javascript For loop: for (let i = 0; i < 5; i++) {
text += "The number is " + i + "
";
}
x = 4 # x is of type int x = "Sally" # x is now of type str print(x)
print ("hello, world!")
== equal to != not equal > greater than < less than >= less than or equal to
Javascript: Use the error() method
Javascript Semicolon Rule: "Semicolon"; "after"; "every"; "line";
SyntaxError: invalid syntax
Javascript While Loop: while (i < 10) { text += "The number is " + i; i++; }
a = 33 b = 33 if b > a: print("b is greater than a") elif a == b: print("a and b are equal")
print(bool("Hello")) print(bool(15))
+Additionx + y -Subtractionx - y *Multiplicationx * y /Divisionx / y %Modulusx % y
Javascript Function: function name(parameter1, parameter2, parameter3) { // code to be executed }
Javascript Operators: +Additionx + y -Subtractionx - y *Multiplicationx * y /Divisionx / y %Modulusx % y
Javascript if Statements: if (condition) { // block of code to be executed if the condition is true }
x = "Python is " y = "awesome" z = x + y print(z)
Javascript Print: console.log("hello,world!");
a = "Hello"
i = 1 while i < 6: print(i) i += 1
fruits = ["apple", "banana", "cherry"] for x in fruits: print(x)