Functios Flashcards
set of instructions and are reusable, perform one action as a best practice.They form the building blocks of a program.
what is a function
set of instructions
variables
hold number, strings and data types at given time
why the variables are undefined?
if we didn’t put a value on it
difference between var and let
when you use let, a variable with the same name can only be declared once.
difference between let and const
Change the code so that all variables are declared using let or const. Use let when you want the variable to change, and const when you want the variable to remain constant.
++; h –;
+1 h -1;
a= a+=6 ; h shortcut a+=6;
otan prostheteis to proigoumeno
px a einai 5
string
a string can be surrounded by single or double quotes
+=
otan prostheteis kati me to proigoumeno
.length
epistrefei to mikos
javascript counting
begins from 0
In JavaScript, String values are immutable, which means that they cannot be altered once created.
you can always reassign a String
remove an item with pop function
.shift() removes the first item
.pop() removes the last element of an array
unshift()adds the elements of the begining of an array
shift() reads the first item
What are parameters
variables that act as placeholders kai einai mesa stin parenthesi
se kathe array vazo ena subarray kai meta vazo komma
what are arguments
values that are passed to an argument
local scope
sth inside a context and sth that contains let, const and myVar
.push()
adds an item to the end of array
.shift()
removes the first element of an array
Strict equality (===) is the counterpart to the equality operator (==). However, unlike the equality operator, which attempts to convert both values being compared to a common type, the strict equality operator does not perform a type conversion.
If the values being compared have different types, they are considered unequal, and the strict equality operator will return false.
3 === 3 // true
3 === ‘3’ // false
In the second example, 3 is a Number type and ‘3’ is a String type.
alt attribute
is used for screen readers to improve accessibility and is displayed if the image fails to load.
<a></a> would link to freecodecamp.org.
what is inline elements
both input and button elements are inline elements, which don’t appear on new lines.
The id attribute is used to identify specific HTML elements. Each id attribute’s value must be unique from all other id values for the entire page.