Skip to content

BloomTech Prompt Examples

Byron Mackay edited this page Jun 21, 2023 · 1 revision

Basic Prompt Breakdown

Role: “Act as…”

Context : Any required background information.

Directive: What is the exact goal that needs to be accomplished?

Prompt 1:

Act as my javascript tutor.

I need to master the .forEach() method. I want to be able to use it in projects and code.

Breakdown the key elements of the loop and show me examples showcasing what I need to know.

Prompt 2:

Act as my coding textbook.

I need to master the following problem:

/**

PROBLEM 4: Given an array of numbers, use the .forEach array method to find the sum of all the numbers in the array

**/

const numbersToSum = [1, 2, 3, 4, 5]; let sum = 0;

//ENTER YOUR CODE HERE

I need to master using .forEach() in all scenarios.

Generate 3 exercises for me to better understand .forEach() and practice.

Prompt 3:

Act as my coding teacher.

I solved the problem above and came up with the following solution:

/**

PROBLEM 4: Given an array of numbers, use the .forEach array method to find the sum of all the numbers in the array

**/

const numbersToSum = [1, 2, 3, 4, 5]; let sum = 0;

numberToSum.foreach((num, index) => { console.log(num); })

//ENTER YOUR CODE HERE

Is this correct? What can I do better?