TypeScript is a superset of JavaScript that includes all the features of JavaScript and more. It provides additional features like static typing, interfaces, classes, and modules to help developers write more robust and maintainable code. In this article, we will discuss why you should use TypeScript for developing web applications and how it can benefit you, with examples. Static Typing One of the primary benefits of TypeScript is static typing. Static typing means variables, function parameters, and function return types must be defined before the code is compiled. This makes it easier for developers to catch errors before the code ... Read More
Lambda expressions offer a succinct and expressive means of defining functions in TypeScript and are versatile enough to be utilized as class methods, object properties, and callbacks in higher-order functions. This tutorial aims to delve into the syntax of lambda expressions, highlight their advantages over conventional functions, and provide guidance on how to use lambda expressions in TypeScript effectively. What are Lambda Expressions? Lambda expressions, commonly referred to as arrow functions, were first introduced in ECMAScript 6 and have gained widespread usage in contemporary JavaScript and TypeScript code. These expressions provide a succinct syntax for defining functions in both languages. ... Read More
Quick Sort is a Divide and Conquer algorithm. In this algorithm, we elect a pivot element and then partition the array around the pivot element. The two partitions are such that one part contains elements all lower than the pivot element and the other part contains elements all higher than the pivot element. Similarly, each part is further partitioned around a pivot selected in each part and this process is executed until one single element is reached. Choosing a Pivot A pivot can be chosen in an array as follows − A random pivot. Rightmost or leftmost element as ... Read More
The structured query language (SQL) commands deal with the manipulation of data present in the database that belongs to the DML or Data Manipulation Language. This includes most of the SQL statements.Examples of DMLThe examples of DML in the Database Management System (DBMS) are as follows −SELECT − Retrieve data from the database.INSERT − Insert data into a table.UPDATE − Update existing data within a table.DELETE − Delete records from a database table.Syntax for DML CommandsThe syntax for the DML commands are as follows −INSERTInsert command is used to insert data into a table.The syntax for INSERT command is as ... Read More
Introduction The epoch is the date and time relative to which a computer's clock and timestamp values are determined. Epoch time is commonly used in computer systems to represent a point in time. It is typically represented as a single integer value, which represents the number of seconds that have elapsed since the epoch. In SQL, you can convert an epoch time value to a date by using the to_timestamp() function. This function converts an epoch time value (which is typically stored as a BIGINT or INT data type) to a timestamp with time zone value. The resulting timestamp value ... Read More
To insert only date value, use curdate() in MySQL. With that, if you want to get the entire datetime, then you can use now() method.Let us first create a table −mysql> create table CurDateDemo -> ( -> ArrivalDate datetime -> ); Query OK, 0 rows affected (0.74 sec)Now you can insert only date with the help of curdate() method −mysql> insert into CurDateDemo values(curdate()); Query OK, 1 row affected (0.15 sec)Display the inserted date with the help of select statement. The query is as follows −mysql> select *from CurDateDemo;Here is the ... Read More
We use the inline style attribute, to set cell padding in HTML. Cell padding is the space between cell borders of the table and the content within a cell of the table. The style attribute is used inside the HTML tag, with the CSS property called padding with a specified value in pixels. Syntax Following is the syntax to set cell padding in HTML. table header Example Following is an example program to set cell padding in HTML. DOCTYPE html> table, th, td { ... Read More
To check if a column is empty or null , we can use the WHERE clause with IS NULL and for empty we can use the condition ' ' i.e., empty space. The steps required for this are as folllows: First a table is created with the help of CREATE command as follows −mysql> CREATE table ColumnValueNullDemo -> ( -> ColumnName varchar(100) -> ); Query OK, 0 rows affected (0.61 sec)An empty value is inserted into the table using INSERT command. This is given below −mysql> INSERT into ColumnValueNullDemo values(' '); Query OK, 1 row affected (0.14 sec)After that, the ... Read More
The task we need to accomplish is converting an input string to an array in JavaScript. Whenever we try to break a string word into characters or a sentence into words – splitting into arrays, we have some built-in methods to convert string to an array. In this article, we will discuss how to convert the string to an array using different methods in JavaScript. Using the split() method This method will split the string to an array of substrings. This will return the output in a new array and will not change the existing string. The split() method accepts ... Read More
Object oriented programming is a type of programming which uses objects and classes its functioning. The object oriented programming is based on real world entities like inheritance, polymorphism, data hiding, etc. It aims at binding together data and function work on these data sets into a single entity to restrict their usage.Some basic concepts of object oriented programming are −CLASSOBJECTSENCAPSULATIONPOLYMORPHISMINHERITANCEABSTRACTIONClass − A class is a data-type that has its own members i.e. data members and member functions. It is the blueprint for an object in object oriented programming language. It is the basic building block of object oriented programming in ... Read More