DeveloperBreeze

function calculateCompoundInterest(principal, rate, time) {
    const compoundInterest = principal * Math.pow(1 + rate / 100, time) - principal;
    return compoundInterest;
}
const principalAmount = 1000;
const interestRate = 5;
const timePeriod = 2;
const compoundInterest = calculateCompoundInterest(principalAmount, interestRate, timePeriod);
console.log('Compound Interest:', compoundInterest);

Continue Reading

Discover more amazing content handpicked just for you

Code

How to Create a New MySQL User with Full Privileges

No preview available for this content.

May 01, 2025
Read More
Code
python

Configuring SQLAlchemy with PostgreSQL on Heroku: A Quick Guide

Instead of manually replacing the URI, you can use libraries like dj-database-url to parse and adapt the DATABASE_URL for different frameworks or drivers. However, the manual approach is straightforward and works well for most cases.

Nov 08, 2024
Read More
Code
php

How to Delete All WordPress Posts and Their Uploads Using a Custom PHP Script

To clear all posts and their associated uploads in WordPress from your custom PHP script using wp-load.php, you can follow these steps:

Make sure your script has access to the WordPress environment by loading wp-load.php:

Oct 25, 2024
Read More
Code
php

How To enable all error debugging in PHP

No preview available for this content.

Oct 25, 2024
Read More
Code
bash

How to Paste in an SSH Terminal Without a Mouse

No preview available for this content.

Oct 20, 2024
Read More
Note
javascript nodejs

Vite vs Webpack

No preview available for this content.

Aug 14, 2024
Read More
Code
nodejs graphql

GraphQL API Server with Node.js and Apollo Server

Run the server using Node.js:

   node index.js

Aug 12, 2024
Read More
Code
javascript

React Custom Hook for API Requests

No preview available for this content.

Aug 12, 2024
Read More
Code
csharp

Unity Inventory System using Scriptable Objects

Create a scriptable object for defining item properties.

using UnityEngine;

// Define the base item as a scriptable object
[CreateAssetMenu(fileName = "NewItem", menuName = "Inventory/Item")]
public class Item : ScriptableObject
{
    public string itemName;
    public Sprite icon;
    public bool isStackable;
    public int maxStackSize = 1;

    public virtual void Use()
    {
        Debug.Log($"Using {itemName}");
    }
}

Aug 12, 2024
Read More
Code
csharp

Unity Player Controller Blueprint

No preview available for this content.

Aug 12, 2024
Read More
Code
bash

Bash: How to Loop Over Files in a Directory

No preview available for this content.

Aug 12, 2024
Read More
Code
csharp

C#: How to Read a File

No preview available for this content.

Aug 12, 2024
Read More
Code
html

HTML: Basic Template Structure

No preview available for this content.

Aug 12, 2024
Read More
Code
php

PHP: How to Connect to a MySQL Database

No preview available for this content.

Aug 12, 2024
Read More
Code
css

CSS: How to Center a Div Horizontally and Vertically

No preview available for this content.

Aug 12, 2024
Read More
Code
java

Java: How to Sort a List

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class SortExample {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("Banana");
        list.add("Apple");
        list.add("Orange");

        Collections.sort(list);

        for (String fruit : list) {
            System.out.println(fruit);
        }
    }
}

Aug 12, 2024
Read More
Code
javascript nodejs

Node.js: How to Create an HTTP Server

No preview available for this content.

Aug 12, 2024
Read More
Code
sql

SQL: How to Select Top N Records

No preview available for this content.

Aug 12, 2024
Read More
Code
python

Python: How to Reverse a String

No preview available for this content.

Aug 12, 2024
Read More
Code
javascript json

How to Deep Clone a JavaScript Object

No preview available for this content.

Aug 12, 2024
Read More

Discussion 0

Please sign in to join the discussion.

No comments yet. Start the discussion!