Showing posts from May, 2015

Front End Interview Questions


Front-end Job Interview Questions This file contains a number of front-end interview questions that can be used when vetting potential candidates. It is by no means recommended to use every single question here on the same candidate (that would take hours). Choosing a few items from this list should help you vet the intended skills you require. Note: Keep in mind that many of these questions are open-ended and could lead to interesting discussions that tell you more about the person's capabilities than a straight answer would. Table of ContentsGeneral QuestionsHTML QuestionsCSS QuestionsJS QuestionsNetwork QuestionsCoding QuestionsFun QuestionsGetting InvolvedContributorsHow to ContributeLicenseGeneral Questions:What did you learn yesterday/this week?What excites or interests you about coding?What is a recent technical challenge you experienced and how did you solve it?What UI, Security, Performance, SEO, Maintainability o…

ID abd Class

ID's are uniqueEach element can have only one IDEach page can have only one element with that ID Classes are NOT uniqueYou can use the same class on multiple elements.You can use multiple classes on the same element. ID's have special browser functionality If you have a URL like, the browser will attempt to locate the element with an ID of "comments" and will automatically scroll the page to show that element. It is important to note here that the browser will scroll whatever element it needs to in order to show that element, so if you did something special like a scrollable DIV area within your regular body, that div will be scrolled too.


JSONP or "JSON with padding" is a communication technique used in JavaScript programs running in web browsers to request data from a server in a different domain, something prohibited by typical web browsers because of the same-origin policy. JSONP takes advantage of the fact that browsers do not enforce the same-origin policy on

What is the difference between call and apply?

The difference is that apply lets you invoke the function with arguments as an array; callrequires the parameters be listed explicitly. A useful mnemonic is "A for array and C for comma." See here and here. Pseudo syntax: theFunction.apply(valueForThis, arrayOfArgs), arg1, arg2, ...) Sample code: function theFunction(name, profession){ alert("My name is "+ name +" and I am a "+ profession +".");} theFunction("John","fireman"); theFunction.apply(undefined,["Susan","school teacher"]);,"Claude","mathematician");via:

What is the difference between a function expression vs declaration in JavaScript?

They're actually really similar. How you call them is exactly the same, but the difference lies in how the browser loads them into the execution context. function declarations loads before any code is executed.  While function expressions loads only when the interpreter reaches that line of code. So if you try to call a function expression before it's loaded, you'll get an error But if you call a function declaration, it'll always work. Because no code can be called until all declarations are loaded.  ex. Function Expression alert(foo());// ERROR! foo wasn't loaded yetvar foo =function(){return5;} ex. Function Declaration alert(foo());// Alerts 5. Declarations are loaded before any code can run.function foo(){return5;}Via:

Difference between script, async and defer

Legend script Let’s start by defining what script without any attributes does. The HTML file will be parsed until the script file is hit, at that point parsing will stop and a request will be made to fetch the file (if it’s external). The script will then be executed before parsing is resumed. script asyncasync downloads the file during HTML parsing and will pause the HTML parser to execute it when it has finished downloading. script deferdefer downloads the file during HTML parsing and will only execute it after the parser has completed. defer scripts are also guarenteed to execute in the order that they appear in the document. When should I use what? Typically you want to use async where possible, then defer then no attribute. Here are some general rules to follow: If the script is modular and does not rely on any scripts then use async.If the script relies upon or is relied upon by another script then use defer.If the script is small and is relied upon by an async script then use an i…

Decreasing Web Page Load Times

Optimize Your Images Know when to use the appropriate file format for your images. Changing to a different file format can dramatically decrease the file size of an image. GIF is ideal for images with few colors like logos.JPEG is great for images with lots of colors and details like photographs.PNG is the choice when you need high quality transparent images. Compress and Optimize Your Content The task of compressing your website content can have a huge impact on reducing load times. When using HTTP compression, all of your web page data is sent in a single smaller file instead of a request that is full of many different files. For more information, see this Wikipedia article on HTTP Compression. You can also optimize and compress your JavaScript and CSS files by combining them and minifying the source code. Put Stylesheet References at the Top Moving your stylesheet references to the  of your HTML document helps your pages feel like it is loading faster because doing so allows your p…

Javascript Null check

You can just check if the variable has a truthy value or not. That means if( value ){} will evaluate to true if value is not: nullundefinedNaNempty string ("")0false The above list represents all possible falsy values in ECMA-/Javascript. Find it in the specification at the ToBoolean section. Furthermore, if you don't know whether a variable exists (that means, if it was declared) you should check with the typeof operator. For instance if(typeof foo !=='undefined'){// foo could get resolved and it's defined} If you can be sure that a variable is declared at least, you should directly check if it has a truthyvalue like shown above. Further read: