June 7, 2024

ExpressJS res.render() Function

In an ExpressJS application if you want to render a view created using HTML templates then that can be done using response.render() function.

In ExpressJS, response.render() renders a view and sends the rendered HTML string to the client.

Syntax

res.render(view, locals, callback)
  • view- A string that is the file path of the view file to render.
  • locals- An object whose properties define local variables for the view. This is an optional parameter.
  • callback- A callback function, it is an optional parameter. callback function takes two arguments error and rendered string.

res.render() example in Express

We are going to use EJS template engines for JavaScript so we need to install EJS which can be done using the following command.

npm install ejs

You can set EJS as templating engine in your application using the following command.

app.set('view engine', 'ejs');

EJS, by default, looks for HTML templates in the views directory in the application root directory. So, let's create a 'views' directory and then create a 'home.ejs' file there with the following code.

views\home.ejs

<h3>Welcome to my site <%= siteName %></h3>

app.js

This file has the code to render the above template.

const express = require('express');
const app = express();
const port = 3000;

app.set('view engine', 'ejs');

app.get('/', (req, res) => {
    // render template
    res.render('home', {siteName: 'knpcode.com'});
})

//Server
app.listen(port, () => {
    console.log(`Example app listening on port ${port}`)
})

Important points to note here-

  1. In res.render(), first argument is the view name which is set as ‘home’. By default, it will look in views folder and view engine is set as ejs so the view resolves to views/home.ejs
  2. There is one variable in the view- siteName. Using second argument, an object whose properties define values for the variables is set.

res.render() with callback function

You can also pass a third argument, a callback function, in res.render() method. With the callback you can intercept the rendered template before sending it. That gives you a chance to change the HTML in anyway you want before sending back the response.

const express = require('express');

const app = express();
const port = 3000;

app.set('view engine', 'ejs');

app.get('/', function(req, res){
    // render template
    res.render('home', {siteName: 'knpcode.com'}, (err, html) => {
        console.log(html);
        res.send(html);
    }); 
});

//Server
app.listen(port, () => {
    console.log(`Example app listening on port ${port}`)
})

If you run the application then you should be able to see the rendered template in the console too because that is done in the callback.

node app.js
Example app listening on port 3000
<h3>Welcome to my site knpcode.com</h3>

That's all for the topic ExpressJS res.render() Function. If something is missing or you have something to share about the topic please write a comment.


You may also like

June 5, 2024

ExpressJS Redirect Using res.redirect()

In a web application you may have many pages and based on some event (like clicking submit button) you want the user to move from one page to another. To do that redirect is used and that's the topic of this article how to redirect from one URL to another or from one path to another in Express.

Redirect in ExpressJS

In ExpressJS response.redirect() method is used to redirect user to another URL.

response.redirect() syntax
res.redirect(status, path)
  • path- Redirects to the URL derived from the specified path
  • status- An optional parameter to send a HTTP status code. Default status code is "302" (Found).

res.redirect() usage examples

1. Redirects can be a fully-qualified URL for redirecting to a different site:

res.redirect('http://knpcode.com')

2. Redirects can be relative to the root of the host name. For example, if the application is on http://knpcode.com/admin/post/new, the following would redirect to the URL http://knpcode.com/admin:

res.redirect('/admin')

3. Redirects can be relative to the current URL. For example, from http://knpcode.com/admin/ (path with a trailing slash), the following would redirect to the URL http://knpcode.com/admin/post/new.

res.redirect('post/new')

4. You can also use '..' which means one level up for redirect. If you were on http://knpcode.com/admin/post/new, the following would redirect to http://knpcode.com/admin/post:

res.redirect('..')

res.redirect example in Express

1. This example shows redirect to another path.

const express = require('express');

const app = express();
const port = 3000;

app.get('/', function(req, res){
    console.log('Redirecting to home page...');
    // redirect to another path
    res.redirect('/home');
})


app.get('/home', function(req, res){
    res.send("<h3>Welcome to my site</h3>");
})

app.listen(port, () => {
    console.log(`Example app listening on port ${port}`)
})

If you run the application and access URL http://localhost:3000 it should redirect you to http://localhost:3000/home

2. Redirect to another fully qualified URL

const express = require('express');
const app = express();
const port = 3000;

app.get('/', function(req, res){
    console.log('Redirecting to another URL...');
    // redirect to another URL
    res.redirect('http://knpcode.com');
})

app.listen(port, () => {
    console.log(`Example app listening on port ${port}`)
})

That's all for the topic ExpressJS Redirect Using res.redirect(). If something is missing or you have something to share about the topic please write a comment.


You may also like

June 4, 2024

Express body-parser With Examples

ExpressJS body-parser is a body parsing middleware which parses incoming request bodies.

You can use body-parser module when you need to parse form data sent by a user by submitting a web form, to parse JSON payloads in REST APIs.

Installing body-parser

You can install body-parser module by using the following command.

npm install body-parser

Parsers in body-parser

This module provides the following parsers-

  1. JSON body parser- For parsing JSON. Though there is a built-in middleware express.json() which can do the same task.
  2. URL-encoded form body parser- Parses urlencoded bodies (form data - application/x-www-form-urlencoded)
  3. Raw body parser- Parses request body as a Buffer
  4. Text body parser- Parses request body as a string

body-parser middleware example with ExpressJS

In the example there is a form which has name and email inputs and submit button to submit the form.

This form is parsed using body-parser in a POST request. There is another route for JSON parser.

views\person.html

<!DOCTYPE html>
<html>
<head>
    <title>Person Form</title>
</head>
<body>
    <form action="/savePerson" method="post">
        <label for="name">Enter Name</label>
        <input type="text" name="name">
        <br/>
        <label for="email">Enter email</label>
        <input type="text" name="email">
        <br/>
        <button type="submit">Submit</button>
    </form>
</body> 

The example uses express.Router() to create modular route definitions.

routes\routes.js

There are 3 route definitions. First is get request for rendering the html file for root path.

There is a POST request for the route '/savePerson' which uses bodyParser.urlencoded()

There is a POST request for the route '/api/Person' which uses bodyParser.json()

const express = require('express');
const path = require('path');
const router = express.Router();

router.get('/', (req, res) => {
    const view = path.join(__dirname, '..', 'views', 'person.html');
    res.sendFile(view);
})

router.post('/savePerson', (req, res) => {
    const name = req.body.name;
    console.log(name);
    const email = req.body.email;
    console.log(email);
    res.send('<h3>Your name is ' + name + ' and email is ' + email + '</h3>');
})

router.post('/api/Person', (req, res) => {
    const name = req.body.name;
    console.log(name);
    const email = req.body.email;
    console.log(email);
    // Then Logic to save Person data

    res.status(201).send("Data Saved Successfully");

})

module.exports = router;

app.js

This is the file where route definitions are imported. You'll import 'body-parser' too to parse the request body.

const express = require('express');

const appRoutes = require('./routes/route')

const bodyParser = require('body-parser'); 

const app = express();
const port = 3000;

// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({extended: true}));

// parse application/json
app.use(bodyParser.json())

// routes
app.use(appRoutes);
//Server
app.listen(port, () => {
    console.log(`Example app listening on port ${port}`)
})

Run the application using the following command

node app.js

If application starts successfully access the URL localhost:3000 which should render a form.

bodyParser.urlencoded

On submitting the form

Express body-parser

In the console you should see the logs too

node app.js
Example app listening on port 3000
TestUser
TestUser@tu.com

For the other route you can use Postman to create a POST request with the JSON body.

{
    "name": "Suresh",
    "email": "suresh@su.com"
}

That's all for the topic Express body-parser With Examples. If something is missing or you have something to share about the topic please write a comment.


You may also like

May 30, 2024

Java Stream sorted() With Examples

In this tutorial we’ll see how to use Java Stream sorted() method with the help of few examples.

Syntax of sorted() method in Java Stream API

There are two variants of sorted() method.

  1. Stream<T> sorted()- Used to sort the elements of the stream according to natural order. If the elements of this stream are not Comparable, a java.lang.ClassCastException may be thrown when the terminal operation is executed.
  2. Stream<T> sorted(Comparator<? super T> comparator)- Used to sort the elements of the stream according to the provided Comparator.

sorted() in Java Stream is a stateful intermediate operation which means it may incorporate state from previously seen elements when processing new elements.

Let us try to understand sorted() method better with the help of some Java examples.

Sort List of integers in natural order

import java.util.List;
import java.util.stream.Collectors;

public class SortedDemo {

  public static void main(String[] args) {
    // Till Java 8
    //List<Integer> myList = Arrays.asList(11, 1, 9, 1, 4, 11, 17);
    // From Java 9
    List<Integer> myList = List.of(11, 1, 9, 1, 4, 11, 17);
    List<Integer> sortedList = myList.stream().sorted().collect(Collectors.toList());
    System.out.println(sortedList);
  }
}
Output
[1, 1, 4, 9, 11, 11, 17]

Since Integer class implements Comparable (compareTo() method) so that becomes the natural ordering for the element while sorting them using sorted() method.

Sort List of integers in reverse order

Sort List of integers in reverse order using sorted() method where Comparator is passed.

public class SortedDemo {

  public static void main(String[] args) {
    // Till Java 8
    //List<Integer> myList = Arrays.asList(11, 1, 9, 1, 4, 11, 17);
    // From Java 9
    List<Integer> myList = List.of(11, 1, 9, 1, 4, 11, 17);
    List<Integer> sortedList = myList.stream()
                     .sorted(Comparator.reverseOrder())
                     .collect(Collectors.toList());
    System.out.println(sortedList);
  }
}
Output
[17, 11, 11, 9, 4, 1, 1]

Sort List of Strings

Since String class in Java also implements Comparable interface so that becomes the natural ordering for the element while sorting them using sorted() method.

public class SortedDemo {

  public static void main(String[] args) {
    // Till Java 8
    //List<String> myList = Arrays.asList("Ram", "Madan", "Jack", "Ram", "Jack");
    // From Java 9
    List<String> myList = List.of("Ram", "Madan", "Jack", "Ram", "Jack");
    List<String> sortedList = myList.stream()
                    .sorted()
                    .collect(Collectors.toList());
    System.out.println(sortedList);
  }
}
Output
[Jack, Jack, Madan, Ram, Ram]

Sorting List of custom objects

With List containing Integers and Strings sorting doesn’t require any extra effort as both of these classes already implement Comparable defining the natural ordering. With custom objects you do need to implement Comparable and provide natural ordering.

Student class used in the example is as given below-

public class Student implements Comparable<Student> {
  private int rollNo;
  private String name;
  private String stream;
  private int marks;
  Student(int rollNo, String name, String stream, int marks){
    this.rollNo = rollNo;
    this.name = name;
    this.stream = stream;
    this.marks = marks;
  }
  public int getRollNo() {
    return rollNo;
  }
  public void setRollNo(int rollNo) {
    this.rollNo = rollNo;
  }
  public String getName() {
    return name;
  }
  public void setName(String name) {
    this.name = name;
  }

  public String getStream() {
    return stream;
  }
  public void setStream(String stream) {
    this.stream = stream;
  }
  public int getMarks() {
    return marks;
  }
  public void setMarks(int marks) {
    this.marks = marks;
  }
  @Override
  public String toString() {
    return "Roll Number: " +  getRollNo() 
        + " Name: " + getName() + " Marks: " + getMarks();
  }
  @Override
  public int compareTo(Student student) {
    return this.getName().compareTo(student.getName());
  }
}

As you can see compareTo() method implementation provides sorting on name so that is the natural ordering for the Student class objects.

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class SortedDemo {

  public static void main(String[] args) {
    List<Student> studentList = Arrays.asList(new Student(1, "Peter", "Science", 75),
              new Student(2, "Ram", "Science", 99),
              new Student(3, "Priscilla", "Art", 68),
              new Student(4, "Ajay", "Art", 67),
              new Student(5, "Dan", "Biology", 77));
    List<Student> sortedList = studentList.stream()
                                          .sorted()
                                          .collect(Collectors.toList());
    for(Student student: sortedList) {
      System.out.println(student);
    }  
  }
}
Output
Roll Number: 4 Name: Ajay Marks: 67
Roll Number: 5 Name: Dan Marks: 77
Roll Number: 1 Name: Peter Marks: 75
Roll Number: 3 Name: Priscilla Marks: 68
Roll Number: 2 Name: Ram Marks: 99

You can also provide your own Comparator implementation by using the sorted method that takes Comparator as an argument. For example suppose you want the List of students sorted by marks.

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class SortedDemo {

  public static void main(String[] args) {
    List<Student> studentList = Arrays.asList(new Student(1, "Peter", "Science", 75),
              new Student(2, "Ram", "Science", 99),
              new Student(3, "Priscilla", "Art", 68),
              new Student(4, "Ajay", "Art", 67),
              new Student(5, "Dan", "Biology", 77));
    List<Student> sortedList = studentList.stream()
                                          .sorted((s1, s2) -> s1.getMarks()-s2.getMarks())
                                          .collect(Collectors.toList());
    for(Student student: sortedList) {
      System.out.println(student);
    }  
  }
}
Output
Roll Number: 4 Name: Ajay Marks: 67
Roll Number: 3 Name: Priscilla Marks: 68
Roll Number: 1 Name: Peter Marks: 75
Roll Number: 5 Name: Dan Marks: 77
Roll Number: 2 Name: Ram Marks: 99

Sorting a Set using Java Stream sorted() method

Sorting a Set is similar to sorting a List. You can create a Stream using the Set and call the sorted() method.

import java.util.HashSet;
import java.util.Set;

public class SortedDemo {
  public static void main(String[] args) {
      Set<String> nameSet = new HashSet<>();
      nameSet.add("Ram");
      nameSet.add("Peter");
      nameSet.add("Ajay");
      nameSet.add("Priscilla");
      nameSet.add("Dan");
      
      nameSet.stream()
             .sorted()
             .forEach(System.out::println);
  }
}
Output
Ajay
Dan
Peter
Priscilla
Ram

Sorting a Map using Java Stream sorted() method

You can sort a HashMap using sorted() method too. In the following example a HashMap is sorted on its values.

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.stream.Collectors;

public class SortedDemo {

  public static void main(String[] args) {
    Map<Integer, String> nameMap = new HashMap<>();
      nameMap.put(1, "Ram");
      nameMap.put(2, "Peter");
      nameMap.put(3, "Ajay");
      nameMap.put(4, "Priscilla");
      nameMap.put(5, "Dan");
      
      System.out.println("-- Original Map --");
      for(Map.Entry<Integer, String> name : nameMap.entrySet()) {
        System.out.println("Key- " + name.getKey() + 
                        " Value- " + name.getValue());
      }
      
      Map<Integer, String> newMap = nameMap.entrySet()
                         .stream()
                         .sorted(Map.Entry.comparingByValue())
                         .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, 
                                  (k,v)->k, LinkedHashMap<Integer, String>::new));
      System.out.println("-- Sorted Map --");
      newMap.entrySet().forEach((e)->{System.out.println("Key- " + e.getKey() + " Value- " + e.getValue());});
  }
}
Output
-- Original Map --
Key- 1 Value- Ram
Key- 2 Value- Peter
Key- 3 Value- Ajay
Key- 4 Value- Priscilla
Key- 5 Value- Dan
-- Sorted Map --
Key- 3 Value- Ajay
Key- 5 Value- Dan
Key- 2 Value- Peter
Key- 4 Value- Priscilla
Key- 1 Value- Ram

To sort on key you can use Map.Entry.comparingByKey() method.

That's all for the topic Java Stream sorted() With Examples. If something is missing or you have something to share about the topic please write a comment.


You may also like

May 29, 2024

Java Stream Sort on Multiple Fields

In this tutorial you’ll see how to sort stream of objects on multiple fields.

Sort stream of objects on multiple fields

To sort a stream of objects on multiple fields you need to use two methods-

1. Stream<T> sorted(Comparator<? super T> comparator)- sorts the elements of this stream according to the provided Comparator.

2. Since sorting is to be done on multiple fields for that you can compose several Comparators using thenComparing(Comparator<? super T> other) method.

Comparator.comparing(COMPARISON_LOGIC)
          .thenComparing(COMPARISON_LOGIC);

Java Stream sorting with multiple fields example

For the example we’ll use the object of User class which has two fields name and age.

public class User {
  private String name;
  private int age;
  User(String name, int age){
    this.name = name;
    this.age = age;
  }
  public String getName() {
    return name;
  }
  public void setName(String name) {
    this.name = name;
  }
  public int getAge() {
    return age;
  }
  public void setAge(int age) {
    this.age = age;
  }
  @Override
  public String toString() {
    return getName() + " " + getAge() + " \n";
  } 
}

If we want to sort on name as well as on age in descending order then it can be done using sorted method of the Java Stream API as given below.

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

public class StreamSort {

  public static void main(String[] args) {
      List<User> userList = Arrays.asList(new User("Peter", 75),
              new User("Ram", 19),
              new User("Peter", 68),
              new User("Mahesh", 32),
              new User("Scott", 32));
      userList = userList.stream()
                         .sorted(Comparator.comparing(User::getName)
                                  .thenComparing(Comparator.comparingInt(User::getAge).reversed()))
                         .collect(Collectors.toList());
      System.out.println(userList);

  }
}
Output
[Mahesh 32 
, Peter 75 
, Peter 68 
, Ram 19 
, Scott 32 
]

To make it clearer here is the elongated version with pre-defined Comparators.

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

public class StreamSort {

  public static void main(String[] args) {
      List<User> userList = Arrays.asList(new User("Peter", 75),
              new User("Ram", 19),
              new User("Peter", 68),
              new User("Mahesh", 32),
              new User("Scott", 32));
      
      Comparator<User> compByName = Comparator.comparing(User::getName);
      Comparator<User> compByAge = Comparator.comparingInt(User::getAge).reversed();
      userList = userList.stream()
                         .sorted(compByName
                               .thenComparing(compByAge))
                         .collect(Collectors.toList());
      System.out.println(userList);
  }
}

That's all for the topic Java Stream Sort on Multiple Fields. If something is missing or you have something to share about the topic please write a comment.


You may also like

May 23, 2024

ExpressJS Middleware Functions

If you have started reading about ExpressJS you would have definitely come across a term called middleware in ExpressJS. You might have thought what is this new complexity in ExpressJS but fear not middleware is just a function with access to request and response objects and it has logic like any other function.

Middleware in ExpressJS

Middleware functions are the functions that take request object, response object and next function as parameters in the application's request-response cycle. The next() function, when invoked with in a middleware, moves the execution to the next middleware.

Using middleware functions you can do the following tasks-

  1. Write any logic which will be executed.
  2. Modify the request and response objects like parsing request body, setting response header.
  3. Call the next middleware function by invoking next() function.
  4. End the request-response cycle by calling response.send()

Let's try to understand middleware function using the following code-

const express = require('express');
const app = express();
const port = 3000;
app.get('/', function(req, res, next){
    console.log('In a middleware');
    next();
})
app.listen(port, () => {
    console.log(`Example app listening on port ${port}`)
})

In the above code app.get() is the HTTP method.

With in the app.get() method middleware function is the given code.

function(req, res, next){
    console.log('In a middleware');
    next();
}

If the current middleware function does not end the request-response cycle be sending a response back, it must call next() to pass control to the next middleware function. Otherwise, the request will be left hanging.

If you run the above example and access the URL http://localhost:3000/ you will get a message on the console 'In a middleware' but the browser won't show you any result as no response is sent back from the server.

Example with middleware functions

Here is another example with three middleware functions. Note the use of next() in the first two middleware functions so that control is passed from first middleware to second. From the third middleware function a response is sent back which also stops the request-response cycle.

const express = require('express');

const app = express();
const port = 3000;

// specific to root path
app.use('/', function(req, res, next){
    console.log('Logging a request for root path');
    next();
})

// middleware applicable to all requests (any path)
app.use(function(req, res, next){
    console.log('In middleware-2');
    next();
})

app.get('/', function(req, res, next){
    console.log('In middleware-3');
    res.send('<h3>Hello from ExpressJS</h3>');
})

app.listen(port, () => {
    console.log(`Example app listening on port ${port}`)
})

On running this example and accessing the URL http://localhost:3000/ you'll see the following messages in the given order.

Logging a request for root path

In middleware-2

In middleware-3

Browser also displays the response sent from the server.

This chaining of middleware functions can be described using the following image.

ExpressJS Middleware Functions

In the above code you can remove the next() function from the first middleware.

app.use('/', function(req, res, next){
    console.log('Logging a request for root path');
    //next();
})

After restarting the server if you access the URL http://localhost:3000/ you won't get any response now as code execution is stuck at the first middleware.

Types of middleware

In an Express application you can use the following types of middlewares.

  1. Application-level middleware- You can bind application-level middleware to an app object (which you get by calling express() function) by using the app.use() and app.METHOD() functions, where METHOD is the HTTP method of the request that the middleware function handles (such as GET, PUT, or POST) in lowercase. We have already seen examples of application-level middleware.
  2. Router-level middleware- Router-level middleware works in the same way as application-level middleware, difference being that it is bound to an instance of express.Router(). You can bind the router-level middleware by using the router.use() and router.METHOD() functions. Read more about express.Router() in this post- express.Router() Function With Examples
  3. Error-handling middleware- You can define error-handling middleware functions too. In that case function takes four arguments instead of three, specifically with the signature (err, req, res, next).
  4. Built-in middleware- Express also has built-in middleware functions like-
    1. express.static- Serves static assets such as HTML files, images, and so on.
    2. express.json- Parses incoming requests with JSON payloads.
    3. express.urlencoded- Parses incoming requests with URL-encoded payloads.
  5. Third-party middleware- You can also use third-party middleware to add functionality to Express apps. For example body-parser which parses HTTP request body, morgan which is a HTTP request logger.

That's all for the topic ExpressJS Middleware Functions. If something is missing or you have something to share about the topic please write a comment.


You may also like

May 22, 2024

express.Router() Function With Examples

In the post ExpressJS Routing With Examples we have already seen how to set up basic routing in ExpressJS. In this post we'll see how to use express.Router() function to create modular route definitions.

The Router instance you get by calling express.Router() function is a complete middleware and routing system on its own. It helps you to create modular route definitions meaning you can create route definitions in separate files and export it. Later you can import the router module in the file where it is needed. Let's see it with the help of an example.

express.Router() example

In the code there is a GET method route which sends a form as response with method as 'POST'. This request should be called first.

Once you have the form and you click the submit button that triggers the post request.

This example uses body-parser package which is used to parse the request body as we want to extract the entered name from the request.

Create a separate routes folder to keep all the route definitions, with in this folder create a file named route.js and write the routes there.

route.js

const express = require('express');

const router = express.Router();

router.get('/hello', (req, res) => {
    res.send('<form action="/name" method="post"><input type="text" name="name"><button type="submit">Submit</button></form>');
})

router.post('/name', (req, res) => {
    console.log(req.body.name);
    const name = req.body.name;
    res.send('<h3>Your name is ' + name + '</h3>');
})

module.exports = router;

Important points about the code.

  1. express.Router() function is used to create a new router object.
  2. Once you’ve created a router object, you can add middleware and HTTP method routes (such as get, put, post, and so on) to it. In the code router.get() and router.post() are used.
  3. Router object is exported using module.exports() so that it can be used in other files.

With that a modular route definition is ready. You can use it in any other file.

Importing modular routes created using express.Router()

We'll import the route definitions in a file named app.js.

app.js

const express = require('express');
const appRoutes = require('./routes/route');
const bodyParser = require('body-parser'); 
const app = express();
const port = 3000;

app.use(bodyParser.urlencoded({extended: true}));
// routes
app.use(appRoutes);
//Server
app.listen(port, () => {
    console.log(`Example app listening on port ${port}`)
})

Important points about the code.

  1. Route definition file is imported by giving the relative path of the file.
    const appRoutes = require('./routes/route');
    
  2. Using app.use() method you can mount the specified middleware function so app.use() is used to mount the route definitions.
  3. With that your app will now be able to handle requests to /hello and /name that are specified in route module.

You can run the application using the following command

node app.js

Example app listening on port 3000

If you go to the URL http://localhost:3000/hello, server gets a GET request for the path ('/hello') and executes the callback function which sends the form as response.

Express routing

Enter a name and press submit which should send a POST request to the server. In the callback function name is extracted from the parsed request body and a response is sent to the user.

That's all for the topic express.Router() Function With Examples. If something is missing or you have something to share about the topic please write a comment.


You may also like