calculateLevel

Calculate the level based on the current experience.

Method calculateLevel

Parameters:

  • experience (number): The current experience points.

Returns:

  • number: The calculated level.

Example Usage:

const LevelAlgorithm = require('level-algorithm');

const levelAlgorithm = new LevelAlgorithm({
  baseExperience: 100,
  experienceMultiplier: 1.5
});

const currentExperience = 350;

const currentLevel = levelAlgorithm.calculateLevel(currentExperience);

console.log(currentLevel); // Output: 5 (based on example current experience)

This method calculates the current level based on the provided current experience, base experience, and experience multiplier within the LevelAlgorithm instance.

Last updated