• Sign Up
    Time to claim your honor
  • Training
  • Practice
    Complete challenging Kata to earn honor and ranks. Re-train to hone technique
  • Freestyle Sparring
    Take turns remixing and refactoring others code through Kumite
  • Community
  • Leaderboards
    Achieve honor and move up the global leaderboards
  • Chat
    Join our Discord server and chat with your fellow code warriors
  • Discussions
    View our Github Discussions board to discuss general Codewars topics
  • About
  • Docs
    Learn about all of the different aspects of Codewars
  • Blog
    Read the latest news from Codewars and the community
  • Log In
  • Sign Up
TheBestCoderOfMyHouse Avatar
Name:Unknown
Clan:Unknown
Member Since:Aug 2018
Last Seen:Dec 2024
Profiles:
    Following:0
    Followers:0
    Allies:0
    View Profile Badges
    • Stats
    • Kata
    • Collections
    • Kumite
    • Social
    • Discourse
    • Published
    TheBestCoderOfMyHousevs.Lifemuzza3 years ago

    Power function

    Test Cases
    Diff
    • const chai = require("chai");
      const assert = chai.assert;
      chai.config.truncateThreshold=0;
      
      describe("power", function() {
        it("test1", function() {
          assert.strictEqual(power( 2,4 ), 16);
          
        });
         it("test2", function() {
          
          assert.strictEqual(power( 2,3 ), 8);
         
        });
        it("test3", function() {
          assert.strictEqual(power( 2,2 ), 4);
          
        });
        it("test4", function() {
      
          assert.strictEqual(power( 2,0 ), 1);
        });
        
         it("test5", function() {
           
          assert.strictEqual(power( 2, -1 ), 0.5);
        });
        
         it("test6", function() {
      
          assert.strictEqual(power( 4, 0.5 ), 2);
        });
        
        it("test7", function() {
      
          assert.strictEqual(power( 8, 1/3 ), 2);
        });
        
        
      });
      
      
      
      • const chai = require("chai");
      • const assert = chai.assert;
      • chai.config.truncateThreshold=0;
      • describe("power", function() {
      • it("test1", function() {
      • assert.strictEqual(power( 2,4 ), 16);
      • });
      • it("test2", function() {
      • assert.strictEqual(power( 2,3 ), 8);
      • });
      • it("test3", function() {
      • assert.strictEqual(power( 2,2 ), 4);
      • });
      • it("test4", function() {
      • assert.strictEqual(power( 2,0 ), 1);
      • });
      • it("test5", function() {
      • assert.strictEqual(power( 2, -1 ), 0.5);
      • });
      • it("test6", function() {
      • assert.strictEqual(power( 4, 0.5 ), 2);
      • });
      • it("test7", function() {
      • assert.strictEqual(power( 8, 1/3 ), 2);
      • });
      • });
    • Fork
    • Discuss (0)
    • Fixture
    • © 2025 Codewars
    • About
    • API
    • Blog
    • Privacy
    • Terms
    • Code of Conduct
    • Contact

    Confirm

    • Cancel
    • Confirm

    Collect: undefined

    Loading collection data...