Can you show the whole code? right now, there are a couple of variables missing. Btw, you don't have to use try/catch until it is absolutely necessary.
consttext=`Example`;constmakeColor=functionmakeColor(input,maxX=Infinity,maxY=Infinity){letX=0;letY=0;letpeakX=-1;letpeakY=-1;if(maxX<Infinity)maxX;constencode=functionencode(input){letestr="";for(constcharaofinput){estr+=String(Number(chara.charCodeAt(0),16));}returnestr;};constcolors=[];letcolor="";letitr=0;for(constcharaofencode(input)){color+=chara;if(color.length>=6){itr+=1;colors.push(color);document.writeln(itr+": "+color+"<br/>");color="";}}if(color.length<6&&color.length>0){color+="0".repeat(6-color.length);colors.push(color);document.writeln(color+"<br/>");color="";}Object.freeze(colors);try{constcanvas=document.getElementById("result");constctx=canvas.getContext("2d");try{for(constcolorofcolors){console.log(X,Y);ctx.fillStyle="#"+color;if(X>maxX){if(peakX<=-1||X>peakX)peakX=X-1;X=0;Y++;ctx.fillRect(X,Y,1,1);X++;continue;}if(Y>maxY)break;ctx.fillRect(X,Y,1,1);X++;}if(maxX>=Infinity)peakY=1;canvas.style.width=canvas.width=peakX;canvas.style.height=canvas.height=peakY;}catch(err){thrownewError();}}catch(err){console.error("Could not draw image!");}};makeColor(text,30);
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Can you show the whole code? right now, there are a couple of variables missing. Btw, you don't have to use
try/catch
until it is absolutely necessary.