JavaScript Basic

0.0(0)
studied byStudied by 2 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/33

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

34 Terms

1
New cards

Commets in JavaScript Coding. Role + different types + Shortcut

it is used for notes or explanations so that humans can read code. The computer ignores it when code runs.

2 different types:

  • //

  • /* */

Shortcut: To comment or uncomment use command key and slash.

2
New cards

What are the data types and what they do?

Undefined- something that has not been define ex. you have not set variable to set anything.

Null- set it to be something and that thing is nothing.

Boolean- true or false

string- to represent text, used by single, double quotes, or backticks.

symbol- an immutable primitive value that is unique.

number- number

object- can store a lot of different key value pairs

Set data into a variable

3
New cards

What is variable? and how to declare a variable.

  • containers for storing information (value).

  • to declare or create variable. ex. declare a variable and set it to something

4
New cards

what are the different ways to declare variables? what are the difference?

  • Var- be able to used throughout your whole program.

  • Let- it is limited of where you declared that.

  • Cons- a variable that never changes.

5
New cards

How do you know if variables are initialized vs. uninitialize?

initialized variables are set to something or an assignment while uninitiliazed does not.

6
New cards

difference between declaration and assignment?

declaration is creating the variable while assignment is giving value.

7
New cards

why is case sensitivity important?

because it will run in the console as undefined, so it is important that that case are exactly the way it is.

8
New cards

what are the two different ways of incrementing(decrementing) numbers? and what are the easier way?

ex. myVar = myVar + 1;

instead,

myVar++;

9
New cards

how to use a remainder? why is it useful?

%

ex.

9 % 2

  • to determine if the number is even or odd.

10
New cards

with compound number, how do you augment addition?

with the assigned value, instead of 12 + a, use += that included to adding a number you like. shortcut. same thing with like subtraction, division, multiplication.

11
New cards

why is backlash important when double quoting?

backlash\ before each quotation mark helps to recognize the one you want to see quoted inside a quotation. It makes it a full string.

12
New cards

what are the different escape sequence?

\’ single quote

\” double quote

\\backslash

\n newline

\r carriage return

\t tab

\b backspace

\f form feed

13
New cards

what is bracket notation?

a way to get a character at a specific index within a string. instead of counting to one. Computers count start from zero

14
New cards

what is .length represent?

it represents how many characters are inside the string

15
New cards

string immutability

they cannot be altered once created. individual character cannot be change it has to be as a whole.

instead of string [0] = “A” . it is string = “Arts”

16
New cards

the difference between bracket notation to finding the Nth character and the Nth to the last character

finding the character is simply [], but the last character is firstName[firstName.length - 1]. It is always.

17
New cards

In bracket notation in finding last character, how can we do if it was the third to last character?

it is the same thing. thirdToLastCharacter = firstName[firstName.length - 3];

18
New cards

How to use word blanks? and how is it formatted?

it is like Mad Lib, provided with sentences with some missing words like nouns, verbs, adjectives, and adverbs.

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {

var result = ““ ——> start with empty array

result += …

return result; ——> to end it

}

19
New cards

difference between array and string

this is array [], this is string ““

20
New cards

what is an array?

always start with a black and end with a bracket to show the beginning and ending of an array, every element of an array is always separated by a comma. Elements can be any data type

21
New cards

difference between regular arrays and nested arrays

[]——> regular arrays

[[‘string’],[numbers]]——→ nested arrays

22
New cards

how do you access array using indexes

the way we can find a string, is the same way we can with the array.

23
New cards

difference between index array and modify array data

the same as string, you can do with array. modify array you can change the specific character you want.

24
New cards

multi-dimensional array

there are more numbers inside the array and more brackets, to access the array, you would use double bracket array.

25
New cards

difference between push and pop array

push is adding something:

pop removes the final element

26
New cards

array shift

it gonna remove the first element

27
New cards

unshift function

similar to push array. but it will replace the first element instead.

28
New cards

how to use reusable function?

put console.log inside bracket then outside bracket, reusableFunction()

29
New cards

what is function in javascript

like a mini machine that does something when you give information.

30
New cards

what is the type of information when the mini machine function something like information is given

that information is called an argument.

31
New cards

what happens after when the function like a mini machine that does something when you give it information, that information is called an argument?

parameters come in. the machine (function) accepts that info through something which is called parameter.

32
New cards

global scope

a variable that has global scope, if you create it outside of any function, block, or curly braces. that means it can be used anywhere in your program.

ex. when you write something in classroom whiteboard, anyone in room can see it - that’s global scope.

33
New cards

local scope

a variable has local scope when it’s declared inside a function (or a block like {}), which means it only exists there. It cannot be use outside that function or block —it’s “locked in”.

ex. you write something in your notebook during class, only you can see it. called local scope.

34
New cards

undefined value return means

variable exist but does not have value yet.