I'm trying to replace random strings characters with a a set amount of
a specific character (i.e: "*"), I'll explain more in the code below.
/**
* Returns a string with replaced amount of strings with a set string
* @param {string} str The input
* @param {number} amountToReplace The amount of letters you want to replace
* @param {string} generalReplace The general letter to replace with
* @returns {string} Returns a string with the string thats finished
*/
var str = 'thisisastring';
var amountToReplace = 5;
var generalReplace = '*'
// Function over here, e.g. with the name replacer
var returnMe = replacer(str, amountToReplac
Sorry if the params sound confusing, I'm still new to them!!
So the string, str is the string that's the input the amountToReplace is the amount of letters you want to replace and the generalReplace is general character you want to replace with.
If the amount is 5, the output I'm expecting is something like:
original: thisisastring
output: th*s**as*ri*g
The string that is returned is supposed to replace random parts in the string(but still do the amount that was inputted, instead of doing 5 replacers but returning 3 as common matches were found).
Thanks!