baglana / feiq

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feiq

  1. What will be printed to the console?
  let a = 10;
  a.b = 10;
  console.log(a);
Output 10
  1. What storages do save data after closing the browser? (LocalStorage, CookieStorage, SessionStorage)
  2. Promise.reject('a')
     .catch(p => p + 'b')
     .catch(p => p + 'c')
     .then(p => p + 'd')
     .finally(p => p + 'e')
     .then(p => console.log(p))
Output abd
  1. What is the function's [[Scope]] property equal to?

    1. Current Lexical Environment
    2. Current Lexical Environment or window
    3. Function doesn't have such property
    4. Lexical Environment in which this function was called
  2. What is HTMLCollection?

    1. An object with numeric keys containing DOM elements and provides additional methods for working with the collection
    2. Array of DOM elements
    3. Array of DOM elements, that has additional methods to work with this collection
    4. An object with numeric keys containing DOM elements and provides methods for working with them like with an array
  3. What will be printed to the console?

var a = 'hello';
function b() {
    if (false) {
        var a = 'world';
    } else {
        var b = 'man';
    }
    console.log(b);
    console.log(a);
}
b();
Output man, undefined
  1. What will be printed to the console?
const map = new Map();

map.set('0', '1');
map.set('s2', '2s');
map.set('3s', 's3');

const arr = [...map.values()];
const result = arr.map(value => parseInt(value, 10));

console.log(result);
Output [1, 2, NaN]
  1. What will be printed to the console?
var x = 10

function bar(funArg) {
    var x = 30;
    funArg();
}

function foo() {
    console.log(x)
}

foo.x = 20;
bar.x = 40;

bar(foo);
Output 10
  1. What will be printed to the console?
var obj = {
    a: () => {
        console.log(this.prop);
    },
    prop: 1
};

obj.a();
var fn = obj.a.bind(obj);
fn();
Output undefined, undefined
  1. What will be printed to the console if we click three times?
class GODListener {
  constructor() {
      this.counter = 0;
  }

  handleClick() {
      this.counter += 1;
      console.log(this.counter);
  }
}

const element = document.getElementById('testBtn');
const listener = new GODListener();

element.addEventListener('click', listener.handleClick);
Output NaN, NaN, NaN
  1. What will be printed to the console?
var a = {};
(function b(a) {
    a.a = 10;
    a = null;
})(a);
console.log(a);
Output { a: 10 }
  1. What will be printed to the console?
console.log(0 || 200);
console.log(0 ?? 400);
console.log(0 && 600);
Output 200 0 0
  1. What is the return type of this function?
async function Fn() {
    if (await CheckUser()) {
        return 42;
    }

    return undefined;
}
Output Promise<42 | undefined>
  1. What will be printed to the console?
console.log(null == undefined);
console.log(null === undefined);
Output true false

About