Return to site

ChatGPT: Using ChatGPT to clean JS code style 🤖🧹

· AI

ChatGPT is a large language model that uses machine learning to generate human-like text. It is based on the GPT (Generative Pre-training Transformer) architecture, which was developed by OpenAI. ChatGPT is trained on a wide range of texts and can be fine-tuned for specific tasks, such as answering questions, writing essays, and more. It can be used in various applications, such as chatbots, language translation, and automated writing.

I wrote some code with style issues:

//check let/var + check indentation
if(true){
var name="inside"
console.log('in the block:'+name)
}


//check arrow fn argument parenthesis
let hello = "Vinny";
hello = val => "Hello " + val;


//check console log content concatenation
let city='Lille'
console.log("I live in "+city);


//check block delimitation 
}

I submitted it to chatGPT and check the result it rendered.

// Check let/var and indentation
if (true) {
  let name = "inside";
  console.log("In the block: " + name);
}

// Check arrow function argument parenthesis
let hello = "Vinny";
hello = (val) => "Hello " + val;

// Check console log content concatenation
let city = 'Lille';
console.log(`I live in ${city}`);

In video: