diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..9d8d516 --- /dev/null +++ b/.babelrc @@ -0,0 +1 @@ +{ "presets": ["es2015"] } diff --git a/src/data/file.js b/src/data/file.js index 8514cd8..cb3c3c6 100644 --- a/src/data/file.js +++ b/src/data/file.js @@ -35,17 +35,17 @@ export function deckData() { { q: "What is event bubbling?", a: - 'An event received by an element doesn\'t stop with that one element. That event moves to other elements like the parent, and other ancestors of the element. This is called "event bubbling".' + 'An event received by an element doesn\'t stop with that one element. That event moves to other elements like the parent, and other ancestors of the element. This is called "event bubbling".' }, { q: "What is event delegation?", a: - "Event delegation allows you to avoid adding event listeners to specific nodes; instead, the event listener is added to one parent. That event listener analyzes bubbled events to find a match on child elements." + "Event delegation allows you to avoid adding event listeners to specific nodes; instead, the event listener is added to one parent. That event listener analyzes bubbled events to find a match on child elements." }, { q: "What is the difference between using == and === ?", a: - "Triple equals uses type coercion and compares both value and type. It prevents unintentional truthy cases like false == 0." + "Triple equals uses type coercion and compares both value and type. It prevents unintentional truthy cases like false == 0." }, { q: "What do we call data types copied by VALUE?", @@ -70,54 +70,54 @@ export function deckData() { { q: "Difference between call() and apply()?", a: - "CALL() takes a regular listing of parameters and APPLY() requires the parameters to be in an array." + "CALL() takes a regular listing of parameters and APPLY() requires the parameters to be in an array." }, { q: "What is the purpose of -this- operator in JavaScript?", a: - "This, always refers to properties or methods accessible to a developer on an object." + "This, always refers to properties or methods accessible to a developer on an object." }, { q: "What are the valid scopes of a variable in JavaScript?", a: - "The region of your program in which it is defined. There are three: \n -Global Variables − A global variable has global scope which means it is visible everywhere in your JavaScript code.\n-Local Variables − A local variable will be visible only within a function where it is defined. Function parameters are always local to that function.\nBlock Scoped variables- variables defined using const/let keywords are scoped to the block in which they are defined." + "The region of your program in which it is defined. There are three: \n -Global Variables − A global variable has global scope which means it is visible everywhere in your JavaScript code.\n-Local Variables − A local variable will be visible only within a function where it is defined. Function parameters are always local to that function.\nBlock Scoped variables- variables defined using const/let keywords are scoped to the block in which they are defined." }, { q: - "Which type of variable among global and local, takes precedence over other if names are same?", + "Which type of variable among global and local, takes precedence over other if names are same?", a: - "A local variable takes precedence over a global variable with the same name." + "A local variable takes precedence over a global variable with the same name." }, { q: "What is callback?", a: - "A callback is a plain JavaScript function passed to some method as an argument or option. Some callbacks are just events, called to give the user a chance to react when a certain state is triggered." + "A callback is a plain JavaScript function passed to some method as an argument or option. Some callbacks are just events, called to give the user a chance to react when a certain state is triggered." }, { q: "Explain Lexical Scoping", a: - 'Lexical Scoping describes how a parser resolves variable names when functions are nested. \nThe word "lexical" refers to the fact that lexical scoping uses the location where a variable is declared within the source code to determine where that variable is available. \nE.G. Nested functions have access to variables declared in their outer scope.' + 'Lexical Scoping describes how a parser resolves variable names when functions are nested. \nThe word "lexical" refers to the fact that lexical scoping uses the location where a variable is declared within the source code to determine where that variable is available. \nE.G. Nested functions have access to variables declared in their outer scope.' }, { q: "What is closure?", a: - "Closures are created whenever a variable that is defined outside the current scope is accessed from within some inner scope." + "Closures are created whenever a variable that is defined outside the current scope is accessed from within some inner scope." }, { q: "Give an example of closure?", a: - "Following example shows how the variable counter is visible within the create, increment, and print functions, but not outside of them −\nfunction create() {\nvar counter = 0;\nreturn {\nincrement: function() {\ncounter++;\n},\n\nprint: function() {\nconsole.log(counter);\n}\n}\n}\nvar c = create();\nc.increment();\nc.print(); // ==> 1\n" + "Following example shows how the variable counter is visible within the create, increment, and print functions, but not outside of them −\nfunction create() {\nvar counter = 0;\nreturn {\nincrement: function() {\ncounter++;\n},\n\nprint: function() {\nconsole.log(counter);\n}\n}\n}\nvar c = create();\nc.increment();\nc.print(); // ==> 1\n" }, { q: "Adding a number and a string results in?", a: - "Coercion: converting a value from one type to another. This happens because JS is dynamically typed." + "Coercion: converting a value from one type to another. This happens because JS is dynamically typed." }, { q: - 'What is the difference between "undefined" and "null" in JavaScript?', + 'What is the difference between "undefined" and "null" in JavaScript?', a: - '"undefined" means variable is declared but not yet assigned a value and null is a value that can be assigned of type "object".' + '"undefined" means variable is declared but not yet assigned a value and null is a value that can be assigned of type "object".' }, { q: "What boolean operators does JavaScript support?", @@ -129,69 +129,69 @@ export function deckData() { }, { q: - 'What is the difference between "undefined" and "not defined" in a JavaScript error?', + 'What is the difference between "undefined" and "not defined" in a JavaScript error?', a: - '"Undefined" means a variable is declared but not assingned any values but "Not defined" means the variable is not declared yet.' + '"Undefined" means a variable is declared but not assingned any values but "Not defined" means the variable is not declared yet.' }, { q: "What is the difference between == and === in JavaScript?", a: - "The == operator checks only equality of the values while === checks equality of values with its datatype i.e. values should be of same type." + "The == operator checks only equality of the values while === checks equality of values with its datatype i.e. values should be of same type." }, { q: - "What are different programming paradigm important for JavaScript developers?", + "What are different programming paradigm important for JavaScript developers?", a: - "Procedural Programming with Object Oriented Programming and Fuctional Programming." + "Procedural Programming with Object Oriented Programming and Fuctional Programming." }, { q: "How can you get type of arguments passed to a function?", a: - 'Using "typeof" operator. Ex- function abc(x){console.log(typeof x, arguments.length);}//Here when function "abc" is called it returns the type and length of passed value.' + 'Using "typeof" operator. Ex- function abc(x){console.log(typeof x, arguments.length);}//Here when function "abc" is called it returns the type and length of passed value.' }, { q: - "What is the disadvantage of creating true private methods in JavaScript?", + "What is the disadvantage of creating true private methods in JavaScript?", a: - "They are very memory inefficient as a new copy of method is created every instance." + "They are very memory inefficient as a new copy of method is created every instance." }, { q: "How to use external JavaScript file?", a: - ' "Here It is assumed that myfile.js is the external js file". ' + ' "Here It is assumed that myfile.js is the external js file". ' }, { q: - 'What is the difference between "undefined" and "null" in JavaScript?', + 'What is the difference between "undefined" and "null" in JavaScript?', a: - '"undefined" means variable is declared but not yet assigned a value and null is a value that can be assigned of type "object".' + '"undefined" means variable is declared but not yet assigned a value and null is a value that can be assigned of type "object".' }, { q: "Explain HOISTING", a: - "Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope before code execution." + "Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope before code execution." }, { q: "What's the difference between .call and .apply?", a: - "The difference is that apply lets you invoke the function with arguments as an array; call requires the parameters be listed explicitly" + "The difference is that apply lets you invoke the function with arguments as an array; call requires the parameters be listed explicitly" }, { q: "What is function composition?", a: - "Function composition is the process of combining two or more functions to produce a new function. Composing functions together is like snapping together a series of pipes for our data to flow through." - }, - { - q: "What is DOM in javascript?", - a: - "A hierarchial structure to access or modify a web page is called Document Object Model or DOM." - }, - { - q: "How do you reference a form field in javascript?", - a: - 'To refer a form field from javascript, you can use : document.getElementById("myform").txtName or document.getElementById("myform") methods' - } + "Function composition is the process of combining two or more functions to produce a new function. Composing functions together is like snapping together a series of pipes for our data to flow through." + }, + { + q: "What is DOM in javascript?", + a: + "A hierarchial structure to access or modify a web page is called Document Object Model or DOM." + }, + { + q: "How do you reference a form field in javascript?", + a: + 'To refer a form field from javascript, you can use : document.getElementById("myform").txtName or document.getElementById("myform") methods' + } ] }, @@ -203,9 +203,9 @@ export function deckData() { cards: [ { q: - "Major difference between function expression vs function declaration?", + "Major difference between function expression vs function declaration?", a: - "Function expression:\n- named or unnamed ex. var myFunc = function( ) { }\n Function declaration: \n- named ex. function myFunc( ) { } " + "Function expression:\n- named or unnamed ex. var myFunc = function( ) { }\n Function declaration: \n- named ex. function myFunc( ) { } " }, { q: "Functions are treated as what type in JavaScript?", @@ -213,22 +213,22 @@ export function deckData() { }, { q: - "What do we call a function that gets executed at the end of an operation, once all of the other operations have been completed", + "What do we call a function that gets executed at the end of an operation, once all of the other operations have been completed", a: "Callback function" }, { q: - "When passing named functions as callback, why might you not normally include parentheses - ex. .addEventListener('click', myFunction)", + "When passing named functions as callback, why might you not normally include parentheses - ex. .addEventListener('click', myFunction)", a: "myFunction() would return result of myFunction" }, { q: - "What is the major difference between functions vs variables in regards to hoisting?", + "What is the major difference between functions vs variables in regards to hoisting?", a: "Some functions are usable before they are declared" }, { q: - "What is a function defined inside an expression, ex. var x = function(){ }?", + "What is a function defined inside an expression, ex. var x = function(){ }?", a: "Function expression" }, { @@ -241,7 +241,7 @@ export function deckData() { }, { q: - "1) Identifying what functions caused errors, 2) more understandable and accessible, 3) easier to reuse, all are major advantages of what type of functions?", + "1) Identifying what functions caused errors, 2) more understandable and accessible, 3) easier to reuse, all are major advantages of what type of functions?", a: "Named functions" }, { @@ -254,7 +254,7 @@ export function deckData() { }, { q: - "Functions that take one or more functions as an input, or functions that output another function, are called?", + "Functions that take one or more functions as an input, or functions that output another function, are called?", a: "Higher order functions " }, { @@ -279,7 +279,7 @@ export function deckData() { }, { q: - "What type of function would this be? \n(function() {\nconsole.log('lumos');\n})();", + "What type of function would this be? \n(function() {\nconsole.log('lumos');\n})();", a: "IIFE (Immediately Invokable Function Expression)" }, { @@ -288,7 +288,7 @@ export function deckData() { }, { q: - "A _____ function is a one that happens to be called with the 'new' operator.", + "A _____ function is a one that happens to be called with the 'new' operator.", a: "Constructor - ex. var g = new Graph()" } ] @@ -307,22 +307,22 @@ export function deckData() { }, { q: - "Returns the index within the calling String object of the last occurrence of the specified value starting?", + "Returns the index within the calling String object of the last occurrence of the specified value starting?", a: "lastIndexOf()" }, { q: - "Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order?", + "Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order?", a: "localeCompare()" }, { q: - "Returns a new string with some or all matches of a pattern replaced by a replacement?", + "Returns a new string with some or all matches of a pattern replaced by a replacement?", a: "replace()" }, { q: - "Executes a search for a match between a regular expression and this String object?", + "Executes a search for a match between a regular expression and this String object?", a: "search()" }, { @@ -331,22 +331,22 @@ export function deckData() { }, { q: - "Splits a String object into an array of strings by separating the string into substrings, using a specified separator string to determine where to make each split?", + "Splits a String object into an array of strings by separating the string into substrings, using a specified separator string to determine where to make each split?", a: "split()" }, { q: - "Returns a subset of a string between one index and another, or through the end of the string?", + "Returns a subset of a string between one index and another, or through the end of the string?", a: "substring()" }, { q: - "Returns the calling string value converted to lower case, according to any locale-specific case mappings?", + "Returns the calling string value converted to lower case, according to any locale-specific case mappings?", a: "toLocaleLowerCase()" }, { q: - "Returns the calling string value converted to upper case, according to any locale-specific case mappings?", + "Returns the calling string value converted to upper case, according to any locale-specific case mappings?", a: "toLocaleUpperCase()" }, { @@ -367,7 +367,7 @@ export function deckData() { }, { q: - "Returns the index within the calling String object of the first occurrence of the specified value?", + "Returns the index within the calling String object of the first occurrence of the specified value?", a: "indexOf()" }, { @@ -384,7 +384,7 @@ export function deckData() { }, { q: - "Adds one or more elements to the end of an array and returns the new length of the array?", + "Adds one or more elements to the end of an array and returns the new length of the array?", a: "push()" }, { @@ -401,12 +401,12 @@ export function deckData() { }, { q: - "Changes the contents of an array by removing existingelements or adding elements?", + "Changes the contents of an array by removing existingelements or adding elements?", a: "splice()" }, { q: - "Returns the characters in a string beginning at the specified location?", + "Returns the characters in a string beginning at the specified location?", a: "substr()" }, { @@ -431,12 +431,12 @@ export function deckData() { }, { q: - "Display an alert message along with asking the user to enter a value?", + "Display an alert message along with asking the user to enter a value?", a: "window.prompt()" }, { q: - "Show a confirmation message and ask the user to confirm or cancel?", + "Show a confirmation message and ask the user to confirm or cancel?", a: "window.confirm()" }, { @@ -457,7 +457,7 @@ export function deckData() { }, { q: - "Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order?", + "Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order?", a: "localeCompare()" }, { @@ -466,32 +466,32 @@ export function deckData() { }, { q: - "Used to find a match between a regular expression and a string, and to replace the matched substring with a new substring?", + "Used to find a match between a regular expression and a string, and to replace the matched substring with a new substring?", a: "replace()" }, { q: - "Returns true if every element in this array satisfies the provided testing function?", + "Returns true if every element in this array satisfies the provided testing function?", a: "every()" }, { q: - "Returns true if at least one element in this array satisfies the provided testing function?", + "Returns true if at least one element in this array satisfies the provided testing function?", a: "some()" }, { q: - "Creates a new array with all of the elements of this array for which the provided function returns true?", + "Creates a new array with all of the elements of this array for which the provided function returns true?", a: "filter()" }, { q: - "Removes the first element from an array and returns that element?", + "Removes the first element from an array and returns that element?", a: "shift()" }, { q: - "Adds one or more elements to the front of an array and returns the new length of the array?", + "Adds one or more elements to the front of an array and returns the new length of the array?", a: "unshift()" }, { @@ -500,12 +500,12 @@ export function deckData() { }, { q: - "Returns the day of the month for the specified date according to local time?", + "Returns the day of the month for the specified date according to local time?", a: "getDate()" }, { q: - "Returns the day of the week for the specified date according to local time?", + "Returns the day of the week for the specified date according to local time?", a: "getDay()" }, { @@ -530,7 +530,7 @@ export function deckData() { }, { q: - "Defines how many total digits (including digits to the left and right of the decimal) to display of a number?", + "Defines how many total digits (including digits to the left and right of the decimal) to display of a number?", a: "toPrecision()" }, { @@ -543,9 +543,9 @@ export function deckData() { }, { q: - "Which string method removed whitespace from either end of a string?", + "Which string method removed whitespace from either end of a string?", a: - "The trim() method returns the string stripped of whitespace from both ends. trim() does not affect the value of the string itself." + "The trim() method returns the string stripped of whitespace from both ends. trim() does not affect the value of the string itself." } ] }, @@ -658,17 +658,17 @@ export function deckData() { { q: "Name a few design patterns for JS", a: - "Module, Singleton, \nPrototype, Observer, \nConstructor, Revealing Module, \nMediator, Command, \nDecorator, Flyweight, \nFacade, Factory, Mixin" + "Module, Singleton, \nPrototype, Observer, \nConstructor, Revealing Module, \nMediator, Command, \nDecorator, Flyweight, \nFacade, Factory, Mixin" }, { q: "What is a Design Pattern?", a: - "A design pattern is a reusable software solution to a specific type of problem that occurs frequently when developing software" + "A design pattern is a reusable software solution to a specific type of problem that occurs frequently when developing software" }, { q: "Describe The Decorator Pattern", a: - "The decorator is defined as a design pattern that allows behaviour to be added to an existing object dynamically" + "The decorator is defined as a design pattern that allows behaviour to be added to an existing object dynamically" }, { q: "What does MVC stands for?", @@ -676,23 +676,23 @@ export function deckData() { }, { q: - "Which pattern is it? Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.", + "Which pattern is it? Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.", a: "Observer pattern" }, { q: - "What does “favor object composition over class inheritance” mean?", + "What does “favor object composition over class inheritance” mean?", a: - "That objects should only include the required functionality from different classes instead of inheriting the whole base class, which will have many unused methods" + "That objects should only include the required functionality from different classes instead of inheriting the whole base class, which will have many unused methods" }, { q: "Define Composite pattern", a: - "The composite pattern says that a group of objects can be treated in the same manner as an individual object of the group" + "The composite pattern says that a group of objects can be treated in the same manner as an individual object of the group" }, { q: - "Which design pattern restricts the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system", + "Which design pattern restricts the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system", a: "Sigleton" } ] @@ -706,17 +706,17 @@ export function deckData() { { q: "What is CSS?", a: - "Cascading Style Sheets, fondly referred to as CSS, is a simple design language intended to simplify the process of making web pages presentable." + "Cascading Style Sheets, fondly referred to as CSS, is a simple design language intended to simplify the process of making web pages presentable." }, { q: "What are the components of a CSS Style?", a: - "Selector − an HTML tag like