JavaScript is a text-based programming language used both on the client-side and server-side that allows you to make web pages interactive. The general-purpose core of the language has been embedded in Netscape and other web browsers.
Q2. Is JavaScript a case-sensitive language?
Yes, JavaScript is a case sensitive language. The language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters.
Q3. How can you create an object in JavaScript?
JavaScript supports Object concept very well. You can create an object using the object literal as follows −
var emp = {
name: "Daniel",
age: 23
};
Q4. How can you create an Array in JavaScript?
var x = [];
var y = [1, 2, 3, 4, 5];
Q5. Can you assign an anonymous function to a variable and pass it as an argument to another function?
Yes! An anonymous function can be assigned to a variable. It can also be passed as an argument to another function.
Q6. What is argument objects in JavaScript & how to get the type of arguments passed to a function?
JavaScript variable arguments represents the arguments that are passed to a function. Using typeof operator, we can get the type of arguments passed to a function. For example −
Q7. What are the scopes of a variable in JavaScript?
The scope of a variable is the region of your program in which it is defined. JavaScript variable will have only two scopes. (1/2)
• Global Variables − A global variable has global scope which means it is visible everywhere in your JavaScript code.
• Local Variables − A local variable will be visible only within a function where it is defined. Function parameters are always local to that function.(2/2)
Q8. What is the purpose of ‘This’ operator in JavaScript?
The JavaScript this keyword refers to the object it belongs to. This has different values depending on where it is used. In a method, this refers to the owner object and in a function, this refers to the global object.
Q9. What is Callback?
A callback is a plain JavaScript function passed to some method as an argument or option. It is a function that is to be executed after another function has finished executing, hence the name ‘call back‘.
Q10. What is Closure? Give an example.
- Closures are created whenever a variable that is defined outside the current scope is accessed from within some inner scope. It gives you access to an outer function’s scope from an inner function. (1/2)
- In JavaScript, closures are created every time a function is created. To use a closure, simply define a function inside another function and expose it.(2/2)
Q11. Name some of the built-in methods and the values returned by them.
Q12. How does TypeOf work?
The typeof operator is used to get the data type of its operand. The operand can be either a literal or data structure such as a variable, a function, or an object. It is a unary operator i.e. placed before its single operand, which can be of any type.
Q13. How to create a cookie using JavaScript?
The simplest way to create a cookie is to assign a string value to the document.cookie object, which looks like this-
Q14. What is the difference between Attributes and Property?
Attributes- provide more details on an element like id, type, value etc.
Property- is the value assigned to the property like type=”text”, value=’Name’ etc.
Q15. What is a Typed language?
Typed Language is in which the values are associated with values and not with variables. It is of two types:
Dynamically: in this, the variable can hold multiple types; like in JS a variable can take number, chars.(1/2)
Statically: in this, the variable can hold only one type, like in Java a variable declared of string can take only set of characters and nothing else.(2/2)
Q16. What is the difference between Local storage & Session storage?
Local Storage – The data is not sent back to the server for every HTTP request – reducing the amount of traffic between client and server. It will stay until it is manually cleared through settings or program.
Session Storage – It is similar to local storage; the only difference is while data stored in local storage has no expiration time, data stored in session storage gets cleared when the page session ends. Session Storage will leave when the browser is closed.
Q17. What is the difference between the operators ‘==‘ & ‘===‘?
The main difference between “==” and “===” operator is that formerly compares variable by making type correction :
e.g. if you compare a number with a string with numeric literal, == allows that, but === doesn’t allow that, because it not only checks the value but also type of two variable, if two variables are not of the same type “===” return false, while “==” return true.
Q18. What is the difference between null & undefined?
Undefined means a variable has been declared but has not yet been assigned a value. On the other hand, null is an assignment value. It can be assigned to a variable as a representation of no value.
Q19. What would be the result of 2+5+”3″?
Since 2 and 5 are integers, they will be added numerically. And since 3 is a string, its concatenation will be done. So the result would be 73. The ” ” makes all the difference here and represents 3 as a string and not a number.
Q20. What is the ‘Strict’ mode in JavaScript and how can it be enable
Strict mode is a way to introduce better error-checking into your code.
- When you use strict mode, you cannot use implicitly declared variables, or assign a value to a read-only property, or add a property to an object that is not extensible.
- You can enable strict mode by adding “use strict” at the beginning of a file, a program, or a function.
• • •
Missing some Tweet in this thread? You can try to
force a refresh
1. Indeed: Best Overall 2. AngelList: Best for Startup Jobs 3. LinkedIn: Best for Connecting Directly With Recruiters 4. LinkUp: Best for Up-to-Date Listings 5. Scouted: Best for Recent College Graduates 6. Snagajob: Best for Hourly Jobs
7. Monster: Runner-Up, Best Overall 8. Glassdoor: Best for Employer Insights 9. FlexJobs: for Remote Jobs 10. The Ladders: Best for Experienced Managers 11. Google for Jobs : job search feature, making it possible for job seekers to search for positions straight through Google
According to stackoverflow’s survey 2020, JavaScript is the most commonly used language for the 8th year straight with 67.7% people opting for it. The major reason for its popularity is the fact that its versatile & can be used for both frontend & backend as well as for testing.
8. JavaScript drawing 9. Reminder app 10. Google home page Clone 11. Tribute page 12. Survey form 13. Exit plugin 14. Weather app
15. Social share buttons 16. Toast notifications 17. AJAX-style login 18. Word counter 19. Countdown timer 20. Modal pop-ups 21. Address book 22. The Movies Dashboard 23. Tic Tac Toe Game 24. E- commerce Site 25. Color picker jumbtron