Front-End Interview Questions – Model A
[ecko_tabs]
[ecko_tab_header id=”q1″]Q1[/ecko_tab_header]
[ecko_tab_header id=”q2″]Q2[/ecko_tab_header]
[ecko_tab_header id=”q3″]Q3[/ecko_tab_header]
[ecko_tab_header id=”q4″]Q4[/ecko_tab_header]
[ecko_tab_content id=”q1″]
Q1 – What is the value of:
var foo = 10 + '20';
[/ecko_tab_content]
[ecko_tab_content id=”q2″]
Q2 – Implement add() so both of these work:
// Example add() function add(a, b) { return a + b; } const resultA = add(4, 9); const resultB = add(4)(9);
https://pastebin.com/
[/ecko_tab_content]
[ecko_tab_content id=”q3″]
Q3 – Implement a bubble-sort algorithm that produces the following result:
const array = [5, 9, 2, 3, 6, 10, 67, 4, 3]; const result = bubbleSort(array); console.log(result); // [2, 3, 3, 4, 5, 6, 9, 10, 67]
https://pastebin.com/
[/ecko_tab_content]
[ecko_tab_content id=”q4″]
Q4 – Fix the code bellow so that tobby.bark() prints to the console:
function Dog(name) { this.name = name; } Dog.bark = function() { console.log(this.name + ' says woof!'); } const tobby = new Dog('Tobby'); tobby.bark();
[/ecko_tab_content]
[/ecko_tabs]