BLACKBOX AI

How to Use BLACKBOX AI to Write, Explain, and Debug Code

A shopper selects “Price: low to high” and sees a 100-dollar item ahead of a 20-dollar one. The page loads, the button responds, and JavaScript reports no error. What would you ask a coding assistant to fix? Give BLACKBOX AI the function, three prices that expose the problem, and the order the shopper should see. Then ask it to explain its diagnosis before it writes any code.

Start at the official BLACKBOX AI sign-in if your organisation already has access. For new buyers, the public website currently directs customers to sales for an annual enterprise agreement. A free coding-chat allowance and individual monthly subscriptions do not appear on its official pricing page, checked on November 17, 2026. You can run every JavaScript example below locally, even without an account.

Start a coding task in BLACKBOX AI

Use the interface your team has configured. If your organisation connects its development tools through the BLACKBOX chat API, enter the prompt in the connected tool. Developers building their own integration send the prompt as a user message, choose a model enabled for their account, and read the assistant’s reply from the response. For follow-up questions, the chat-completion request accepts conversation history. Official chat API documentation

For a first task, choose one function with an answer you can recognise. A whole catalogue page introduces distracting possibilities: the click handler, the product feed, the rendering code, and the sorting function could each cause a display problem. If three invented numbers reproduce the failure in isolation, you already have enough evidence for a useful question.

The prompts below are examples you can send in sequence. The explanations give you a reference for judging the response you receive. The JavaScript results were checked in Node.js independently of a BLACKBOX session.

Step 1. Reproduce the price-sorting bug

Imagine you maintain a shop where visitors can switch between the merchant’s featured order and the cheapest items. The following function is supposed to return prices from lowest to highest. Try it in a browser’s developer console, or save it as before.cjs and run node before.cjs if you have Node.js installed.

function sortPrices(prices) {
  return prices.sort();
}

const featured = [20, 100, 3];
console.log(sortPrices(featured)); // [100, 20, 3]
console.log(featured);             // [100, 20, 3]

The first line of output reveals the problem the shopper reported. The second reveals a problem they might discover later. A visitor who switches back to “Featured” could see the wrong order because the function has rearranged the source array. Write down both requirements before asking for a fix: the sorted result should be [3, 20, 100], and the featured list should remain [20, 100, 3].

Ask BLACKBOX AI to explain what happened

Paste the snippet and send this prompt:

Walk through this JavaScript function using the three prices shown. Why does 100 appear before 20? What happens to the original array? Explain both console lines in plain English and hold the fix until the next message.

Look for two details in the answer. First, when JavaScript sorts these numbers without a comparison function, it uses their string representations to determine order. The first character of “100” comes before the first character of “20”, just as “A100” would come before “B20” in a list of product codes. The array elements themselves remain numbers. Second, sort() rearranges the array in place, so another reference to that array sees the change. MDN’s JavaScript sort reference

If the reply says your database supplied strings, ask which line supports that diagnosis. Here the input is written directly in the program as numeric literals. Asking for evidence from the snippet keeps an otherwise plausible explanation from sending you off to inspect a database that plays no part in this bug.

Step 2. Ask it to write the smallest useful correction

Rewrite only sortPrices. It receives an array of finite JavaScript numbers in one currency. Return a new array sorted from lowest to highest. Preserve duplicates and the original order of the input array. Keep the function name and use no external packages.

A correction that meets the requirements is short enough to review in one glance:

function sortPrices(prices) {
  return [...prices].sort((a, b) => a - b);
}

const featured = [20, 100, 3];
console.log(sortPrices(featured)); // [3, 20, 100]
console.log(featured);             // [20, 100, 3]

The spread syntax, [...prices], makes a new array. The sorting method can rearrange that copy freely. Subtraction gives the sorting method a direction: for 20 and 100, the result is −80, so 20 belongs earlier. Equal prices produce zero. The function returns prices with the same values and types it received.

A common partial fix is prices.sort((a, b) => a - b). It gets the shopper’s first screen right. It also quietly overwrites the featured order. This is why specifying what the rest of the page should still be able to do matters as much as reporting the visible bug.

Step 3. Ask for a test that would catch the old bug

Write runnable Node.js checks using node:assert/strict. Include the original failing example, an independent check of the input after sorting, an empty list, and a list containing zero, duplicate prices, and a decimal. Write the expected values explicitly.

Save the following as price-sort.cjs. It contains the corrected function and requires no package installation beyond Node.js itself.

const assert = require("node:assert/strict");

function sortPrices(prices) {
  return [...prices].sort((a, b) => a - b);
}

const featured = [20, 100, 3];
assert.deepEqual(sortPrices(featured), [3, 20, 100]);
assert.deepEqual(featured, [20, 100, 3]);
assert.deepEqual(sortPrices([20, 0, 20, 3.5]), [0, 3.5, 20, 20]);
assert.deepEqual(sortPrices([]), []);

console.log("All price-sort checks passed.");

Run node price-sort.cjs. The expected output is All price-sort checks passed. To see what the checks protect, temporarily replace the return line with return prices.sort();. The first check fails. Try return prices.sort((a, b) => a - b); next. Now the first check passes and the second fails. Restore the corrected line afterward.

When reviewing an AI-written test, read the right-hand side of each assertion. If the test calculates the expected result by calling the same function a second time, both calls can make the same mistake and still agree. Three hand-ordered numbers make a stronger test than a hundred numbers sorted by the code under investigation.

Adapt the example to a real website

A product catalogue usually contains records with names, IDs, and prices. Sorting an isolated list of amounts and then attaching the old names by position can give a shopper the wrong price for an item. Keep each record together and sort a copy of the records by their numeric price field. Give BLACKBOX two invented products and ask for a test that checks both the product IDs and their order.

Check where the numeric value comes from, too. A label such as “€1.299,50” is already formatted for display. A formatter may add currency symbols, grouping marks, or spaces. If your catalogue includes a numeric amount in one currency, use that field for sorting and keep the formatted label for display. If it lists multiple currencies, decide which currency the shopper is browsing in before defining “lowest”.

For a client whose prices originate at the till, first establish which system owns the catalogue and supplies the website’s price field. A guide to POS system software covers that side of the workflow. For merchants managing products inside Shopify, the Shopify Sidekick guide covers tasks they can handle in the store admin.

BLACKBOX AI pricing, usage limits, and regional access

The official pricing page lists one Enterprise offering for new buyers. Here is what you can establish before speaking to sales.

Access option Price and billing Usage limits
Free access No public free plan or trial price listed No published free message allowance
Individual Pro, Pro Plus, or Pro Max No current public monthly or annual purchase price listed No current individual quota published there
Enterprise Custom quote with an annual spending commitment Usage draws down the balance by model and token volume. Rate limits are contractual, and unused commitment expires at period end.

A token is a unit of text processed by the model. A long file sent with a question adds input tokens, and a lengthy explanation adds output tokens. The vendor lists input, output, and cached-read rates separately. Ask for the billing currency, taxes, minimum commitment, and rate limits in your written quote. The public pricing page gives no complete country eligibility list. International teams should confirm service availability and the required data-hosting region for their deployment.

Is it worth paying for? For a student with an occasional debugging question, this exercise alone gives little reason to pursue an annual contract. A team considering one can take five bugs it already understands, have developers solve them with the tool, and record time spent reviewing corrections alongside usage. Count a task as finished when its tests pass. That gives you a cost per accepted fix and a basis for estimating how much of an annual commitment the team would use.

FAQs

Can BLACKBOX AI help me learn without giving away the solution?

Yes. Try asking, “Give me one hint about how JavaScript decides which item comes first. Wait for my prediction before showing any code.” Predict the output for [9, 80], then run it. That small change of input shows whether you understood the rule or simply remembered the previous answer.

What if the suggested fix works in isolation but fails on my site?

Inspect one sample value immediately before the real function runs. Is it a number, a formatted string, or a product record? Then check which array the page renders afterward. Create an invented sample with that same structure and ask BLACKBOX to revise the test. This narrows the next question while keeping client records out of the conversation.

Do I need to upload a project to debug one function?

For this example, the function, sample input, and expected output are sufficient. If a caller changes the result, add that caller next. A freelancer can usually reproduce a price-ordering problem with invented product names and amounts, leaving customer details, credentials, and private repository contents out of the prompt.

Final Words

Before handing over a catalogue fix, try the two actions a shopper would take: select “Price: low to high”, then switch back to “Featured”. If both views show the expected order, you have checked the customer’s experience as well as the function. Keep the failing example with the fix so the next person who edits the code can check it just as quickly.

Leave a Comment

Your email address will not be published. Required fields are marked *