microsoft / microsoft/pxt-microbit

number.toString takes no params, browser takes a radix

Open
#1,254 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

apis
Dominant language
TypeScript
Stars
804
Forks
721
Avg merge
2d 9h
Merged PRs (30d)
2

Description

Is your feature request related to a problem? Please describe.
I am trying to build a counter with a micro:bit that represents binary numbers using Neopixels, it is currently difficult to convert an integer from base10 to base2, though that is easy in the browser. You can just pass the radix in as a param, but the make code platform number.toString takes no args.

Describe the solution you'd like
Reflect the toString functionality that is standard in the browser

Describe alternatives you've considered
A new function for going from base 10 to a base 2 string could work

Additional context
Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementation of number.toString and the tests or entry points covering number conversion in the MakeCode micro:bit project. Compare its current behavior with the browser's radix argument. Done means callers can provide a radix and the binary conversion use case is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
api, embedded-iot
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.