Wednesday, November 27, 2013

Advance Javascript/jQuery Interview questions

1) How many selectors of jQuery you have used?

2) What is chaining in jQuery?

3) What is the different between GET and POST? Which to use when explain with the example.

4) What are the best practice you follow for the performance of the site?

5) How to use cache in your website?

6) What is the disadvantage of using global variables in JS?

7) When to use Stringify and when not to use?

8) When to use Multi-Dimensional Arrays?

9) How will you decide for animations when to use CSS3 and when to use JS?

10) How to make HTML templates by JS

Happy Coding!!

Friday, November 22, 2013

CUFON Font : All you want to know about CUFON!!

In this post we are going to talk about the CUFON fonts and the 4 tips that every UI developer must know.
Before going into the deep discussion let's start from the basics.

What is CUFON?
As per the documentation of CUFON, cufon aims to become worthy alternative to the SIRF. Let's talk in lay man words, in every website design we aim to achieve the smoothness and sharpness of the fonts on the web browser - what we see on the PSD. But thanks to the browser limitation we are not able to achieve that.

But CUFON overcome this limitation and helps us to get the same smoothness as we are seeing in PSD of fonts and that too without uses of images.

It also work with all fonts - web safe fonts/Wen-Non-safe fonts.

Why we need CUFON?
As we have already talked that aim of every UI developer to replicate the PSD 100% on browser but we always have to compromise with the quality of the fonts. Cufon help us to overcome this and help us to achieve the smoothness of the fonts we are expecting without use of images.

Advantage of CUFON?
1) No-Plugins required - We don't need to load any extra JS file as plugin to support it. Only we need to generate our fonts file on cufon website.
2) Compatibility  - It work on all major browsers and especially it works on IE too.
3) Ease of Use - No and Zero-Configuration required for it , simple to use
4) Fast - It's very fast even for small to large text.

How To use?
Using Cufon is the most simple task to do:
1) Go to website http://cufon.shoqolate.com/generate/ upload your fonts
2) Generate the cufon files.
3) Link them to your webpage
4) Activate them by writing : cufon.replace('h1')

You can read full documentation here to https://github.com/sorccu/cufon/wiki/Usage

Pro Tips to use Cufon

1) Multiple Fonts??
Instead of keeping different file for wach fonts, it's better to use one file and merge all fonts code into that,
It will help you to save HTTPS code and give the performance of your website a boost.

2) How to make the underline hovering effect to work?
Cufon don't support underline text-decoration property, to make it achieve the trick is to use border-bottom instead.

3) Active your hyperlinks (<a>) tags
By default cufon don't activate the hyperlinks . To activate them you have to make the hover property to true.

Links to know more:

http://cufon.shoqolate.com/generate/
http://www.cufonfonts.com/

Happy Coding!!!


Thursday, November 21, 2013

Modernizr Vs InnerShiv

Hi,

Today I am discussing here about the Modernizr and InnerShiv. The topics we are going to cover are:

- Introduction
- Features
- Where to use?
- Links

Ok, so let's start the basic questions here - "what are these frameworks for and why we need it?"

INTRODUCTION

If you  are new to HTML5 than you are right place. HTML5 came with the most awesome tags to make our markup to finally be semantic. But all thanks to our dear IE browsers who don't understand HTML5 and if you make your first HTML5 website by using the tags like - Header, footer, section, aside etc and will open on IE you will get a heart attack.

Your website which is working fine on all modern browser is blowing on IE and your reaction will be  "WHY?? and HOW TO FIX IT??"

The answer or solution is Modernizr and InnerShiv.

These 2 plugins will help you to look same on IE as it is on modern browser, so, to get the HTML5 tag support on IE we use these plugins..


FEATURES

Although both plugin help you to give support of HTML5 tags on IE but still both have their own features and make them unique .

InnerShiv
InnerShivalso know as Tag-Detection plugin.It only have the functionality to detect the tag support on the browser and if that browser dont have the capability to identify the HTML5 tags it will help to identify that.


Modernizer
Modernizr id "Feature-Detection Plugin". Modernizr is much bigger and powerful than InnerShiv. It not only consider HTML5 but also consider CSS3 too.

As, in case with the HTML5 on old browsers same is with the CSS3, old browsers dont understand css3.

It not only help you to detect the support of the HTML5 tags but also helps to detect the features of CSS3 too.


WHERE TO USE?

If your project is very simple and don't have any css3 features implementation like - gradients, Border Radius, animations etc. but only have HTML5 support  than you should go with the InnerShiv.


If your project have CSS3 features usage like - gradients, text shadow, box shadow etc than you must use the Modernizr as it will detect the browser itself which don't support the CSS3 features and HTML5 tags.

It will append the classes on the body  of your page on the basis of the availability of the feature on that browser.If the browser dont have any particular feature supported it will add "no-" prefix before that property as a class and add to body of your page.

On basis of these classes you can now write your css and js that what will happen when particular feature is not supported.


LINKS:

http://modernizr.com/
https://code.google.com/p/html5shiv/

Happy Coding!!

Tuesday, November 19, 2013

Java script Interview questions - Part 2

1) What is unobtrusive java script?
A.Unobtrusive Java script means that the logic should be handle in the java script and HTML should only contain the view not the java script code.It is a clear division between the logic and UI.

2) What is Name spacing?
A. Java script is bad scripting language, it can lead to developer to escape with bad coding and achieve the functionality.One of the bad practice is to declare the global variables which is evil for the coding. Hence name spacing is the concept to declare a unique name and bundle all methods/objects/properties with that.It also helps us to avoid the name conflict too.

It helps in creating modularity and try to reuse the code in application?

3) What is Undefined and Null?
A. Undefined: When you have declare a variable but have not assigned and value to it.
                           Undefined is the "type" itself.
                           Undefined is always set by the java script with the value "undefined".

NULL: NULL is the assignment value.
            NULL is an object itself
             NULL is never set by the java script, it is done programmatic only.

4) Where we should place our java script on web page?
A. We should place our java script as an external file and at bottom of the page.





Javscript Interview Questions

1) How we can write java script on a web page?
A. There are 3 ways to write Java script on the webpage.Which are:
- Inline java script : we can call the java script functions with the tags.
- External java script : We can give reference to the external java script o the webpage
- On webpage : We can write <script></script> on the page and start writing our java script code

2) Is java script Case Sensitive?
A. Yes, java script is case sensitive scripting language


3) How many data-types in java script?
A. We have the following data types in java script:
- Boolean
- Object
- String
- Array
- Number
- Function
- NULL
- Undefined


4) Is Java script is automatic data conversion language?
A. Yes, java script can automatically detect the data and its type and convert to same.
Eg: var a = "hello"; // typeof(a) : String


5) What is the difference between "==" and "==="?
A. Although both are the comparison operators but former just compare the values in the Left/right side whereas later will also check the type and value of the comparison value.

Eg: var a = 11,
              b = "11";

(a == b) // true
(a === b) // false - as the one is number and other is string


6) How you create Array in java script?
A. var names = new Array();
names[0] = 'neha',
names[1] = 'naina'

Other way:

var names = new Array('neha','naina');

7) Index of Array starts from?
A. Zero (0)

8) What does "2" + 3+2 will give you output?
A. 232 // As the first character ('2') is string .i.e, the calculation will be string operation

9) What does 2 + 3 + "2"will give you output?
A. 52 (As the first two are integer hence the addition will take place and last one is string hence it will take concentation: 52)

10) What are jQuery and DOJO?
A. These are the frameworks of the java script . We can use either library and write the java script by using the library syntax.