My AI Prompt Engineering Experience #6 - Chat GPT and JavaScript

Richard Saunders

Prompt Engineer
Blog Writer
ChatGPT
JavaScript

Based on the previous post, I realized that I could use Chat GPT to create code. So my next idea was to see if I could use Chat GPT to update my old JavaScript projects that I've done in 2022.



Here is my following JavaScript code:

// ROSCA SANTIGRIA - Simulation Football League Stats

// GOAL - To create a JAVASCRIPT coded version of my SFL Football Stats.

// Hype Huskies - Season 2 Episode 16

const playerInformation = {

    playerName: "Rosca Santigria",
    playerRank: "Gold",
    playerOverall: "78.46",
    season: "SFL SEASON 18",
    legendsFace: "Walter Payton",

    position: "Cornerback",
    jerseyNumber: 35,
    starPlayer: "YES",
    weight: 218,
    height: "6 ft 1 in",
   

}


// playerStats: The stats my SFL player

const playerStats = {
speed: 92,
agility: 92,
stamina: 87,
strength: 62,
jump: 90,
coverage: 90, 
aggressiveness: 69,
tackle: 70, 
catch: 40,
passRush: 20,
runCoverage: 45, 
consistency: 90,
}


/* highValueAnimation: Explains the animatuions my SFL player has. 

Bump Master = Bump Master is an animation that allows the Cornerback
to bump agains the Wide Receiver. This slows them down and leaves
them open for a pass deflection or interception.

*/

const highValueAnimations = {
    animationOne: "Bump Master",

}


// PLAYER EXTRA DETAILS

const playerExtraDetails = {
    age: 58,
    face: "FACE1",
    hand: "RIGHT",
    leftGlove: "WHOLE",
    leftShoeTape: "FALSE",

    muscleType: "RIPPED",
    rightShoe: "COLOR 3",
    runStyle: "FINESSE",
    turtleNeck: "NONE",

    bodyType: "NORMAL",
    faceShield: "DARK",
    kickStyle: "TRADITIONAL",
    leftGloveColor: "COLOR 3",
    leftWrist: "NONE",
    
    nasalStrip: "FALSE",
    rightGlove: "WHOLE",
    rightShoeTape: "FALSE",
    skinTone: "DARK",


    eyeBlack: "FALSE",
    faceMask: "TYPE 13",
    leftElbow: "NONE",
    leftShoe: "COLOR 3",
    legPads: "LIGHT",

    neckRoll: "NONE",
    rightGloveColor: "COLOR 3",

}


console.log(playerInformation)
console.log(playerStats)
console.log(highValueAnimations)
console.log(playerExtraDetails)



The cool thing about JavaScript is that I can use const to place in variables and other forms of data. We don't need all of the code for Chat GPT, only the const playerStats section will do for now.



// playerStats: The stats my SFL player

const playerStats = {
speed: 92,
agility: 92,
stamina: 87,
strength: 62,
jump: 90,
coverage: 90, 
aggressiveness: 69,
tackle: 70, 
catch: 40,
passRush: 20,
runCoverage: 45, 
consistency: 90,
}



So I'm going to write the following Chat GPT Prompt.



Take the following JavaScript code " " and change "stamina: 87", to "stamina: 90" and change "runCoverage: 45" to "runCoverage:55". Keep the rest of the playerStats the same numbers after making the update.





Chat GPT has successfully changed the stats to their updated numbers.



I'll also copy the code here as well!



const playerStats = {
  speed: 92,
  agility: 92,
  stamina: 90,
  strength: 62,
  jump: 90,
  coverage: 90, 
  aggressiveness: 69,
  tackle: 70, 
  catch: 40,
  passRush: 20,
  runCoverage: 55, 
  consistency: 90,
};



This was just a simple post on updating my stats with Chat GPT. We can use it for future iterations and possibly convert the JavaScript to another coding language!





Partner With Richard
View Services

More Projects by Richard