Java Terms Flashcards
(18 cards)
confirm()
user must respond to questions (cancel or ok)

prompt
user must type an answer

strings
a string of letters or number between quotations (“Michael”)
.length
after a string, this command will tell you the length of the string
boolean
a code that is either ‘true’ or ‘false’
console.log()
printing out, will take whatever is in the () and log it to the console
if statement
if the condition is true, the code in the { } will run
if { } else { }
If the condition is true: run code, else (otherwise): run this code instead
modulo %
The computer will divide the numbers between the modulo % and return the remainder.
For example: 23 % 10 = 3
.substring(x,y)
logs the string between the two given points (x,y)
For Example: “Hello”.substring(0,2)
Logs: “He”
var myAge = 35
you can declare a variable to be called up anytime
variables can be changed in the algorithm
var myCountry = “USA”
console. log(myCountry.length);
console. log(myCountry.substring(0,4));
This would print out the following:
3
USA
comparisons
=>
<=
===
<
>
var someName = function (something)
{};
creates a variable (someName)
and an input for the function (parameter)
{input and code to run};
(must end with a semi colon ;)
parameter
the placehoder in a function for an input
sayHello(“Michael”)
Calling a function requires the variable associated with the function as well as the paramerter input.
return (an output of a function)
you can return a number inside a function which will be used in another line of code as in:
var someNumber = fucntion(number)
{return number *8};
var newNumber = someNumber(9)
console.log (newNumber)
for loops
for (i = x; i < x; i++)
increment up by 1 i++
increment down by 1 i–
increment up by any value +=
increment down by any value -=