r/reviewmycode • • 7d ago

JAVA [JAVA] - Please Review My Code Thank you. its an introduction text.

I have just started learning how to code in JavaScript. Slowly working through free camp code and its fundamentals on JavaScript.

I reached the section where its stating to follow along and apply what you learnt so far with variables, strings and concatenation. So I decided to try have a little fun with it in VSC to explore a little more.

So here is the code. Let me know what you think and what can be improved. Feedback is useful to me learning more.

let greeting = () => {


// code for accessing user name currently logged into system
let botLocation = () => {
    let path = require('path');
    var userName = process.env['USERPROFILE'].split(path.sep)[2];
    var loginId = path.join("domainName",userName);
return loginId;
};


const introduction = "Hello! I'm";
let botName = "CodeBot";
const fullIntroduction = introduction.concat(" ",botName + " and I'm located in " + botLocation());


// code to create a type writer effect
   function textTypingEffect(text, i = 0) {
    process.stdout.write(text[i]);


    if (i === text.length - 1) 
        return;
    
    setTimeout(() => textTypingEffect(text, i + 1), 50);
}
    
textTypingEffect(fullIntroduction);
}


greeting();
0 Upvotes

0 comments sorted by