How to prevent content(Tasks) to disappear after REFRESHING

I am trying to make a simple To-Do like application. I want the “Tasks” which I add to remain even after closing the window or at least after refreshing. I tried to achieve that using MongoDB but I couldn’t.
I think a simpler way to achieve this is by using arrays but I am not able to understand how to do that.
Please suggest me some way to achieve the above results….

let div = document.getElementById('tasks');
let add = document.getElementById('add');
let newTask = document.getElementById('newTask');

let c = 0;

add.addEventListener("click", function () {
    let newt = newTask.value;
    newTask.value = null;
    let cbox = document.createElement("input");
    let br = document.createElement("br");
    cbox.type = "checkbox"; = "check";
    let d = document.createElement("div");
    div.append(d); = "nd";
    c += 1;
    if (c === 12) {
        add.disabled = true;
        newTask.value = "Stack Overflow";
/* body {
    background-color: #42f5f5
} */

.card {
    margin: 0 auto;
    float: none;
    /* margin-bottom: 10px; */
    /* border: none; */
    /* background-color: rgb(248, 179, 88); */

.container {
    margin-top: 2.5rem;

#title {
    width: 200px;
    border: none;
    font-size: larger;
    font-weight: bold;

#newTask {
    width: 200px;

#add {
    margin-top: 1rem;

#newTask {
    margin-top: 1rem;

#plus {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;

#nd {
    font-size: 20px;
    margin-top: 5px;
    margin-bottom: 10px;

#check {
    margin-left: 20px;
    height: 15px;
    width: 15px;
    margin-right: 10px;
<!doctype html>
<html lang="en">

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

        <link rel="stylesheet" href="[email protected]/dist/css/bootstrap.min.css"
            integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
        <link href="ToDo.css" rel="stylesheet">


        <div class="container">
            <div class="card" style="width: 35rem;height: 42rem;">
                <div class="card-body">
                    <p style="font-size: 2rem;font-weight: bold;">
                        <input type="text" class="form-control" id="title" placeholder="Title">
                    <p id="main">
                    <div id="tasks">

                    <form class="form-inline">
                        <div class="form-group mx-sm-3 mb-2">
                            <input type="text" class="form-control" id="newTask" autocomplete="off"
                                placeholder="Enter new task">
                        <button type="button" class="btn btn-primary mb-2" id="add">Add Task</button>

        <script src="ToDo.js"></script>
        <script src=""
        <script src="[email protected]/dist/umd/popper.min.js"
        <script src="[email protected]/dist/js/bootstrap.min.js"