The most basic Java Script Interview Questions
 

JavaScript developed by Netscape. JS is a client side as well as a server-side scripting language. It is interpreted programming language as well with object orientated capabilities.

1. How do you create a class in JavaScript?

Answer – There are multiple ways you can create a class in JS. For example

Method 1 – Using functions

// This is a class name

function Flat(aptName, location){

// You can define object properties

this.aptName = aptName;

this.location = location;

this.getLocation = getLocationInfo

}

// The method can be defined as

function getLocationInfo{

return “The location is “ + this.location;

}I

// You can even define function of a class like this

Flat.prototype.getFlatInfo = function() {

alert (“The apartment name is” +   this.aptName + “ and the location is “ + this.location = location);

// Instantiate new object of Flat class

var myFlat = new Flat(“Manjeera”, “Kukatpally”);

// Invoke methods like this

alert myFlat.getLocationInfo();

Method 2 – Using object literals

Var Flat = {

this.aptName = “manjeera”;

this.location = “kukatpally”;

this.getLocation = function() {

return “The location is “ + this.location;

}

}

Apart from using functions, and object literals, you can use object constructor as well to create JavaScript class.

2. What is the difference between ‘==’ and ‘===’?

Answer –       ‘==’ checks for equality only

‘===’ checks for equality and type

For example

false == 0 returns TRUE

false === 0 returns FALSE

3. What is isNan? Give example?

Answer – This would return true of the argument is not a number. For example

isNaN(23) returns false

isNaN(“2/3/2017”) returns true

4. What are the difference comments available in JavaScript?

Answer – There are two types of comments available in JavaScript

A. Single line comments

// This is a single line comment

B. Block comments

/*

This can be used

For block comments

..

*/

5. What are the types used by JavaScript?

Answer – There are six types used in Java Script

Boolean (True and False)

Null (null)

Undefined (undefined)

Number (Integers, floating etc.)

String

Object (Objects, Array, Functions etc.)

6. Is JavaScript a case sensitive?

Answer – Yes, JavaScript is case-sensitive.

7. How can you create an object in JavaScript

Answer – You can use object literal as shown below

var student  = {

name: “Sandeep”,

age: 36

};

Alternatively, you can use below (As explained in question number 1)

var myFlat = new Flat(“Manjeera”, “Kukatpally”);

8. Does JavaScript support exception handling?

Answer – Yes, it does support exception handling by means of try and catch. It supports try, catch, finally, throw etc. keywords to handle exceptions.

9. What is the difference between break and continue?

Answer – Break statement causes program control to exit from the loop.

The continue statement causes program control to continue with next statement.

10. What is the primary difference between ViewState and SessionState?

Answer – ViewState represents a page in session while SessionState is specific to user specific data which can be accessed all across in the web application.

 

 

 

 

 

 

 

 

The five dysfunctions of a team – How to build a great team
 

I got an opportunity to drive ‘team book reading’ with my highly competent team for one of the very critical facets of team building i.e. “What it takes to be successful as a Team”. The book chose was “The five dysfunctions of a team – A leadership fable” which I personally found very interesting hence thought of sharing the summary with you all.

Precisely the book talks about the five dysfunctions of a team that restricts the team to be successful. It is very important to understand and overcome them in order to be more effective as a team. The dysfunctions are

Absence of trust
Trust & respect are the foundation stones of any relationship be it a home or office. If the members of the team do not trust each other then they cannot be completely honest with each other.

Hence “Create Trust” by following but not limited to:

  • 360-degree feedback
  • Spend time together
  • Understand each other personal history
  • Believe in each other
  • Be honest

Fear of conflict – Without trust, team members will not have healthy debates that are necessary to arrive at better thought through decisions.
It’s very important to have open lines of communication (so that everyone is clear & aligned). Always remember

  • Open discussions. Debate leads to a better solution
  • Focus on the issue, not the individual.

Hence “Value Conflict” (It has to be in a healthy way!) by following but not limited to:

  • Straight talk
  • Calling people on behavior traits that demonstrate fear of conflict
  • Identify how we respond
  • The leader leads in behavior

Lack of commitment – If the team has not aligned to a decision then the individual members who did not agree with the final decision will ultimately be less committed to that decision. It is important to know that the “Alignment” is more important than agreement

Hence “Encourage commitment” by following but not limited to:

  • Summaries decisions made in group discussions or meetings
  • Come to consensus — Any decision is better than no decision – Timeboxing decisions.
  • Clarify all scenarios including worst-case ones.
  • Talk it loud, hear everyone’s opinion.

Avoidance of accountability – If they are not committed to the course of action, then they are less likely to feel accountable (or hold other people accountable). Lack of clarity of roles & responsibilities and not holding individuals accountable leads to “Avoidance of accountability”
Hence “Promote Accountability” by following but not limited to

  • Open disclosure of goals, standards, and metrics
  • Continuous progress reviews
  • Reward for a team not individual

Inattention to results – If the individuals are not accountable, they are less likely to care about the group results (Instead they would focus on achieving their individual goals).
Hence “Celebrate Results” by following but not limited to:

  • Group declaration of results
  • The reviews to be based on results.
  • The leader should lead to behavior.

Disclaimer “This is a just summary of the book we read – In order to have more details, you are required to read the complete book”.

You can find the book at this link

or

Click on below

Employee Ranking System (ERS) – Products and Technology
 

What is an employee ranking?

It’s an ordered list of employees from “most valuable” to “least valuable” derived out of the ERS (Employee-Ranking System)

What’s the purpose of an employee ranking?

It provides a logical and consistent framework for employee advancement, recognition, and rewards.  It can unearth and expose significant inequities.  If used on an on-going basis, it can provide valuable insight into employee performance and development trends.

How is “value” defined?

Different definitions make sense in different organizations.  We will consider three major dimensions – competence, the level of contribution, and value to the business.  In other words, how skilled the employees at what they do, how productive are they at what they do, and how irreplaceable are their specific skills or knowledge.  For each dimension, we will consider both “performance to date” as well as the “potential for the future”.  Since performance to date is less ambiguous than future potential, we will give it greater weight. Potentially this would help you to identify core members of your

What process will we use?

We’ll list all employees in a spreadsheet with some basic demographic information, their previous ladder evaluations, and the staff member they report to.  For each of your employees, you will rate them from 1-4 (4 being highest) in the three dimensions described above. You will leverage the details mentioned in this word document below in order to identify rating 1 to 4.  You’ll do that once for past performance and once for future potential for these three areas.  We will then total the numbers and ladder all engineering employees together, assigning a 70% weighting to demonstrated performance and a 30% weighting to future potential. You can download the spreadsheet by clicking on below link

ERS – Products and Technology Ladder

How should I calibrate my evaluations?

Keep in mind that the evaluations are independent of job level and experience.  The idea is to identify “most valuable” to “least valuable” That is, it is perfectly reasonable and generally expected for junior employees to get lower scores than more senior employees.  In fact, when that doesn’t happen, that’s a sign of either a high flying junior employee or an under-performing senior employee.  In addition, you can look at previous years’ rankings to get a sense of overall calibration.  Then, use the supplementary guidance in the sections below.

How precise will all this be?

Don’t worry too much about the precision of the numbers.  Our goal is to get relative ranking right.  The numbers give us a big head start in aligning our reference points and in creating a single merged list for the whole organization.  Once we have a consolidated list, the leadership team can ensure right people are in the right place.

Any other helpful instructions?

  • Please be careful not to break any of the formulas in the spreadsheet.
  • If you see errors in any cell, please highlight the cell and make the appropriate correction.
  • For the Rating column, enter your best estimate of the numeric performance rating (from 1-5) that the employee will receive this year or whatever your rating system is.
  • For the Promotion and the Performance Improvement Plan columns, enter a “Y” if you believe the employee should be on one of these tracks for the current year. Otherwise, you can leave the column blank.

The ranking would be derived from three core factors

  1. 1. Competence
  2. 2. Contribution
  3. 3. Value to business

Competence

Areas to consider:

  • – Breadth and depth of knowledge and skills
  • – Leadership and innovation, applied to people, processes, and projects
  • – Problem-solving ability
  • – Technical, business, communication, interpersonal skills

Rating 4:
Has mastered all required skills. Demonstrates strong leadership in one or more areas (e.g., technical, project management, process, etc.).  Consistently works to leverage skills for team and larger organization success.

Rating 3:    
Often operates above the norm, with advanced skills in some areas. Often expends extra effort to help meet goals. Has demonstrated leadership in one or more areas.

Rating 2:   
Has all basic skills for job category and uses them effectively to meet project goals.

Rating 1:   
Needs additional skills development to meet job requirements and to attain project goals. May demonstrate inconsistent achievement of task objectives and project goals.

Contribution

Areas to consider:

  • -Ability to meet commitments
  • – Overall productivity and volume of output
  • – Early communication of problems and contribution to workarounds that meets business goals
  • – Versatility – willingness and ability to adapt to new tasks
  • – Teamwork – willingness and ability to help others
  • – Leadership skills such as architecture, project management, change management, communication, and mentoring
  • – Ability to motivate others, manage self, and demonstrate initiative.

Rating 4:  
Someone who has a lot of initiative, is a  leader across the organization, and has outstanding productivity.

Rating 3:   
Someone who excels in 1 or 2 of these dimensions but not all 3.

Rating 2:   
Someone who delivers what is expected (i.e. does not take much initiative to do more), is a team player but not a leader, and has productivity as expected.

Rating 1:    
Someone who is below expectations in one or more of these dimensions.

Value to the Business

Areas to consider:

  • – Knowledge and skills as mapped to needs of the business
  • – Extra points here for unique skills we need

Rating 4:    
A critical person on a high profile project, creating a vision or blueprint for the project or accomplishing critical business objectives.  Without this person, current and future objectives would not be accomplished.

Rating 3:  
A core person on a high profile project.  Without this person, current and future objectives would be impaired.

Rating 2: 
Could be replaced without significant negative impact to the business.

Rating 1:     
The negative impact to the business. Drains resources and causes objectives not to be accomplished.