Basic 2 Flashcards

1
Q

do two lines without template strings (es5) and both methods.

A

html = ‘<ul><li>Name: ‘ + name + ‘</li><li>Age: ‘ + age + ‘ </li><li>Job: ‘

html = ‘<ul>’ +
‘<li>Name: ‘ + name + ‘</li>’ +
‘<li>Age: ‘ + age + ‘</li>’ +</ul></li></ul>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The formula of template strings (es6)

A
html = `
<ul>
  <li>Name: ${name}</li>
  <li>Age: ${age}</li>
</ul>
`;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What you can do in (es6 template)?

A

You can do expressions, show functions, and add if statements as well.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what it’s the console.log for html document?

A

document.body.innerHTML = html

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what arrays can do ?

A

they allow to store multiple values in one value, they can be muted and the can be used in some really complex alghoritmens

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the 2 ways of creat an array? show the formula.

A
const numbers = [43,56,33,23,44,36,5];
const numbers2 = new Array(22,45,33,76,54);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What kind of information can be within an array?

A

const mixed = [ 22, ‘Hello’, true, undefined, null, {a:1, b:1}, new Date()];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Type the formulas for:

  • Get array length
  • Check if is array
  • Get single value
  • Find index of value
  • Add on to end
  • Add on to front
  • Take off from end
  • Take off from front
  • Splice values
  • Reverse
  • Concatenate array
  • Sorting arrays
A
val = numbers.length;
val = Array.isArray(numbers);
val = numbers[3];
val = numbers.indexOf(36);
numbers.push(250);
numbers.unshift(120);
numbers.pop();
numbers.shift();
numbers.splice();
numbers.reverse();
val = numbers.concat(numbers2);
val = fruit.sort();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the ‘COMPRE FUNCTION’ formula ?

A

val = numbers.sort(function(x, y){
return x - y;
});

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the ‘FIND function formula?

A
Find
function under50(num){
  return num < 50;
}

val = numbers.find(under50)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly