
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 9150 Articles for Object Oriented Programming

1K+ Views
In JavaScript if the data is not an object and has no methods and properties is called as a primitive data type or a primitive value. The different types of primitive data types in JavaScript are string, number, Boolean, undefined, symbol, null and big int. The primitive types boolean, string and number can be wrapped by their wrapper object, i.e., instances of the Boolean, String and Number constructors respectively. To get the back the primitive values back from the object wrappers, we need to call the valueOf() method on the objects. Example Following example demonstrates the primitive and object types ... Read More

21K+ Views
Typecasting in JavaScript means converting one data type to another data type i.e., the conversion of a string data type to Boolean or the conversion of an integer data type to string data type. The typecasting in JavaScript is also known as type conversion or type coercion. Types of conversions The type casting is of two types in JavaScript. They are the implicit type conversions and the explicit type conversions. Implicit type casting The implicit type casting is the conversion of data type done due to the internal requirement or automatic conversion by the compiler or the interpreter. To understand ... Read More

698 Views
JavaScript has two values for nothing i.e., null and undefined. These two are also the primitive types in JavaScript. Undefined Out of the two values, Undefined in JavaScript means if a variable is declared and no value is assigned to the variable, then this variable is said to be undefined. An object can also be null. It is said to be null when there is no value to it. Example 1 This example of the undefined value in JavaScript. var str console.log('The value of given variable is:', str) In the above example 1, a variable named ‘str’ is declared. ... Read More

290 Views
The String object lets you work with a series of characters; it wraps Javascript's string primitive data type with a number of helper methods. As JavaScript automatically converts between string primitives and String objects, you can call any of the helper methods of the String object on a string primitive.Following are some of the methods available for strings in JavaScript −concat() −Combines the text of two strings and returns a new string.indexOf() −Returns the index within the calling String object of the first occurrence of the specified value, or -1 if not found.lastIndexOf() −Returns the index within the calling String ... Read More

247 Views
The split([separator, [limit]]) method 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.Example usage of split methodlet a = "hello, hi, bonjour, namaste"; let greetings = a.split(', '); console.log(greetings)Output[ 'hello', 'hi', 'bonjour', 'namaste' ]Note that the commas were removed here. Any separator provided will be removed.If separator is an empty string, str is converted to an array having one element for each character of str.Examplelet a = "hello"; console.log(a.split(""))Output[ 'h', 'e', 'l', 'l', 'o' ]If no separator is provided, the string is ... Read More

12K+ Views
The Globally Unique Identifier (GUID) or (Universally Unique Identifier) is a 16-byte or 128- bit binary value that is used as an identifier standard for software construction. This 128-bit number is represented in a human-readable format by using the canonical format of hexadecimal strings. One example is like: de305d84-75c4-431d-acc2-eb6b0e5f6014. In this article, we shall cover how we can use javascript functionality to generate GUID or UUID. There are a few different methods, covered one by one: By using random number generation Example function generate_uuidv4() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { ... Read More

1K+ Views
Camel case is the practice of writing phrases such that each word or abbreviation in the middle of the phrase begins with a capital letter, with no intervening spaces or punctuation. For example, Concurrent hash maps in camel case would be written as −ConcurrentHashMapsWe can implement a method to accept a string in JavaScript to convert it to camel case in the following way −Examplefunction camelize(str) { // Split the string at all space characters return str.split(' ') // get rid of any extra spaces using trim .map(a => a.trim()) ... Read More

586 Views
No there is not a standard function to check for null, undefined or blank values in JavaScript. However, there is the concept of truthy and falsy values in JavaScript. Values that coerce to true in conditional statements are called truth values. Those that resolve to false are called falsy. According to ES specification, the following values will evaluate to false in a conditional context − null undefined NaN empty string ("") 0 false This means that none of the following if statements will get executed − if (null) if (undefined) if ... Read More

154 Views
Using for..in loops in JavaScript with array iteration is a bad idea because of the following behavior −Using normal iteration loops −Examplelet arr = [] arr[4] = 5 for (let i = 0; i < arr.length; i ++) { console.log(arr[i]) }Outputundefined undefined undefined undefined 5If we had iterated over this array using the for in construct, we'd have gotten −Examplelet arr = [] arr[4] = 5 for (let i in arr) { console.log(arr[i]) }Output5Note that the length of the array is 5, but this still iterates over only one value in the array.This happens because the purpose of ... Read More

3K+ Views
In multithreading when we deal with threads there comes the requirement of pause and start a thread for this Threading provides two methods wait and join which are used for the same.The following are the important differences between wait() and join().Sr. No.Keywait()join()1Declarationwait() method is defined in Object class and hence the wait() method is declared in java.lang package.join() method, on the other hand, is also defined in java.lang package but in Thread class.2Usagewait() method is primarily used for the inter-thread communication.On the other hand join() is used for adding sequencing between multiple threads, one thread starts execution after first thread ... Read More