Ai Coding Tools

How to Use GitHub Copilot to Write Your First Function in 15 Minutes

By BTW Team3 min read

How to Use GitHub Copilot to Write Your First Function in 15 Minutes

If you’ve ever stared at a blank screen, wondering how to start coding a function, you’re not alone. Many of us have been there, overwhelmed by the possibilities and unsure where to begin. Enter GitHub Copilot, an AI-powered coding assistant that can help you write your first function in just 15 minutes. While it sounds almost too good to be true, I’m here to walk you through exactly how to do it, with some honest insights along the way.

Prerequisites: What You Need to Get Started

Before diving in, make sure you have the following:

  • GitHub Account: You’ll need an account to access Copilot.
  • Visual Studio Code: This is the IDE where we'll be using Copilot.
  • GitHub Copilot Subscription: As of March 2026, pricing is $10/month for individuals or $19/month for teams, with a 30-day free trial available.

Step 1: Install GitHub Copilot in Visual Studio Code

  1. Open Visual Studio Code.
  2. Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window.
  3. Search for "GitHub Copilot" and click on the install button.
  4. Once installed, you'll need to sign in with your GitHub account to activate it.

Expected Output: You should see the Copilot icon in the bottom right corner of your VS Code.

Step 2: Start Writing Your Function

  1. Create a new JavaScript file (e.g., myFunction.js).
  2. Type a comment describing the function you want to create, such as // A function that adds two numbers.
  3. Hit Enter, and Copilot will suggest a complete function based on your comment.

Expected Output: Copilot should generate a function like this:

function addNumbers(a, b) {
    return a + b;
}

Step 3: Test Your Function

  1. Below the function, write a small test to see if it works:
console.log(addNumbers(2, 3)); // Expected output: 5
  1. Run the code by using the terminal in VS Code.

Expected Output: You should see 5 printed in the console.

Troubleshooting: Common Issues

  • Copilot Not Suggesting Code: Make sure you’re typing in a supported language and that Copilot is enabled.
  • Suggestions Not Relevant: Try rephrasing your comment or providing more context. The clearer you are, the better suggestions you’ll get.

What’s Next: Expanding Your Skills

Once you’ve successfully written your first function, consider the following next steps:

  • Explore More Functions: Try writing functions that manipulate data structures or handle API requests.
  • Integrate with Other Tools: Look into how Copilot works with testing frameworks like Jest or Mocha to ensure your functions are robust.

Conclusion: Start Here

Using GitHub Copilot to write your first function can be both empowering and educational. It significantly reduces the friction of starting from scratch and provides helpful suggestions as you code. Just remember, while it’s a fantastic tool, it’s not perfect—always review and test the generated code.

If you’re ready to dive into AI-powered coding, give GitHub Copilot a try. With its subscription starting at $10/month, it’s a small cost for a potentially big boost in productivity.

Follow Our Building Journey

Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.

Subscribe

Never miss an episode

Subscribe to Built This Week for weekly insights on AI tools, product building, and startup lessons from Ryz Labs.

Subscribe
Ai Coding Tools

10 AI Coding Tools That Will Drastically Reduce Your Debugging Time

10 AI Coding Tools That Will Drastically Reduce Your Debugging Time As a developer, whether you're just starting out or have years of experience, debugging can feel like a neverend

Oct 16, 20265 min read
Ai Coding Tools

10 Common Mistakes When Integrating AI Coding Tools into Your Workflow

10 Common Mistakes When Integrating AI Coding Tools into Your Workflow As developers, we’re always on the lookout for ways to streamline our workflow and boost productivity. Enter

Oct 14, 20264 min read
Ai Coding Tools

5 Myths About AI Coding Tools That Could Hurt Your Development Process

5 Myths About AI Coding Tools That Could Hurt Your Development Process As a solo founder or indie hacker, you might be lured by the promises of AI coding tools that claim to simpli

Oct 13, 20264 min read
Ai Coding Tools

5 Common Mistakes Developers Make When Using AI Coding Tools in 2026

5 Common Mistakes Developers Make When Using AI Coding Tools in 2026 As AI coding tools have become an integral part of a developer's toolkit in 2026, many are still stumbling over

Oct 12, 20264 min read
Ai Coding Tools

5 Myths About AI Coding Tools: What Every Developer Should Know in 2026

5 Myths About AI Coding Tools: What Every Developer Should Know in 2026 As we dive into 2026, the landscape of AI coding tools has evolved significantly, yet many developers still

Oct 11, 20263 min read
Ai Coding Tools

Why AI Coding Assistants Are Overrated for Beginners in 2026

Why AI Coding Assistants Are Overrated for Beginners in 2026 As a solo founder or indie hacker, it’s tempting to think that AI coding assistants are the silver bullet to jumpstart

Oct 10, 20263 min read