Start a new Kumite
AllAgda (Beta)BF (Beta)CCFML (Beta)ClojureCOBOL (Beta)CoffeeScriptCommonLisp (Beta)CoqC++CrystalC#D (Beta)DartElixirElm (Beta)Erlang (Beta)Factor (Beta)Forth (Beta)Fortran (Beta)F#GoGroovyHaskellHaxe (Beta)Idris (Beta)JavaJavaScriptJulia (Beta)Kotlinλ Calculus (Beta)LeanLuaNASMNim (Beta)Objective-C (Beta)OCaml (Beta)Pascal (Beta)Perl (Beta)PHPPowerShell (Beta)Prolog (Beta)PureScript (Beta)PythonR (Beta)RacketRaku (Beta)Reason (Beta)RISC-V (Beta)RubyRustScalaShellSolidity (Beta)SQLSwiftTypeScriptVB (Beta)
Show only mine

Kumite (ko͞omiˌtā) is the practice of taking techniques learned from Kata and applying them through the act of freestyle sparring.

You can create a new kumite by providing some initial code and optionally some test cases. From there other warriors can spar with you, by enhancing, refactoring and translating your code. There is no limit to how many warriors you can spar with.

A great use for kumite is to begin an idea for a kata as one. You can collaborate with other code warriors until you have it right, then you can convert it to a kata.

Ad
Ad
Code
Diff
  • const main = () => {
      const a = [1, 2, 3]; 
      const b = [4, 5, 6];
      const c = [7, 8, 9];
      
      return [...a, ...b, ...c].join(',');
    }
    • const main = () => {
    • let a = [1, 2, 3];
    • const a = [1, 2, 3];
    • const b = [4, 5, 6];
    • const c = [7, 8, 9];
    • let b = [4, 5, 6];
    • let c = [7, 8, 9];
    • // converter para ES6
    • var d = a.concat(b).concat(c);
    • return d.join(',');
    • return [...a, ...b, ...c].join(',');
    • }
Code
Diff
  • const prop = 'myProp';
    
    var obj = {
      [prop] : 123,
      myFunc() {
        return this[prop];
      }
    };
    • // reescreva usando ES6
    • var prop = 'myProp';
    • const prop = 'myProp';
    • var obj = {
    • myFunc: function() {
    • [prop] : 123,
    • myFunc() {
    • return this[prop];
    • }
    • };
    • obj[prop] = 123;
    • }
    • };
Code
Diff
  • class Component {
      constructor(dom) {
        console.log('Parent class constructor executed!');
        this.dom = dom;
      }
      
      onCreate() {
        return true;
      }
    }
    
    class Collection extends Component {
        constructor(dom,flag){
          super(dom);
          this.flag=flag;
        }
      // 
    }
    • class Component {
    • constructor(dom) {
    • console.log('Parent class constructor executed!');
    • this.dom = dom;
    • }
    • onCreate() {
    • return true;
    • }
    • }
    • class Collection {
    • class Collection extends Component {
    • constructor(dom,flag){
    • super(dom);
    • this.flag=flag;
    • }
    • //
    • }
Code
Diff
  • var bg = `gray`;
    
    var css = ` <style>
      body { 
        background: ${bg};
        color: black;
      }
      </style>`;
      
    
    • var bg = 'gray';
    • var bg = `gray`;
    • var css = '' +
    • '<style>' +
    • 'body {' +
    • ' background: '+ bg + ';' +
    • ' color: black;'
    • '}' +
    • '</style>';
    • var css = ` <style>
    • body {
    • background: ${bg};
    • color: black;
    • }
    • </style>`;
Code
Diff
  • // reescreva em ES6
    function main(a, b = 2, c = 3) { 
        return a * b * c;
    }
    • // reescreva em ES6
    • function main(a, b, c) {
    • if (typeof b == 'undefined')
    • b = 2;
    • if (typeof c == 'undefined')
    • c = 3
    • function main(a, b = 2, c = 3) {
    • return a * b * c;
    • }

This is a simple example of a hello world in C++

#include <iostream>

int main(){
  
  std::cout << "Hello C++" << endl;
  
}
Code
Diff
  • const sum = (a, b) => a + b;
    • function sum(a,b) {
    • return a+b; // wrong returning
    • }
    • const sum = (a, b) => a + b;

Разработайте функцию sumNechet (a,b), возвращающую сумму всех нечетных чисел из диапазона от a до b (a < b). Для проверки текущего числа на нечетность создайте функцию нечетное (x)

sumNechet(0, 5) // 9

Code
Diff
  • function нечетное(x) {
    
    }
    
    function sumNechet(a, b) {
     
    }
    • function sumNechet(a, b) {
    • function нечетное(x) {
    • }
    • function нечетное(число) {
    • function sumNechet(a, b) {
    • }
Code
Diff
  • function addArr(arr){
      return arr.length?arr.reduce((a,e)=>a + e,0):null;
    }
    • function addArr(arr){
    • if(arr.length === 0) return null
    • let final = 0
    • arr.forEach(num => {
    • final += num
    • })
    • return final
    • return arr.length?arr.reduce((a,e)=>a + e,0):null;
    • }