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.
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 ES6var d = a.concat(b).concat(c);return d.join(',');- return [...a, ...b, ...c].join(',');
- }
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;
- }
- //
- }
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>`;
This is a simple example of a hello world in C++
#include <iostream>
int main(){
std::cout << "Hello C++" << endl;
}
Разработайте функцию sumNechet (a,b), возвращающую сумму всех нечетных чисел из диапазона от a до b (a < b). Для проверки текущего числа на нечетность создайте функцию нечетное (x)
sumNechet(0, 5) // 9
function нечетное(x) { } function sumNechet(a, b) { }
function sumNechet(a, b) {- function нечетное(x) {
- }
function нечетное(число) {- function sumNechet(a, b) {
- }
// Since Node 10, we're using Mocha. // You can use `chai` for assertions. const chai = require("chai"); const assert = chai.assert; // Uncomment the following line to disable truncating failure messages for deep equals, do: // chai.config.truncateThreshold = 0; // Since Node 12, we no longer include assertions from our deprecated custom test framework by default. // Uncomment the following to use the old assertions: // const Test = require("@codewars/test-compat"); describe("Solution", function() { it("проверка на разных a и b", function() { // Test.assertEquals(1 + 1, 2); assert.strictEqual(sumNechet(0,5),9); assert.strictEqual(sumNechet(0,15),64); }); it("фнкция нечетное вызывается в функции sumNechet", function() { assert.strictEqual(sumNechet.toString().includes("нечетное"),true); }); });
- // Since Node 10, we're using Mocha.
- // You can use `chai` for assertions.
- const chai = require("chai");
- const assert = chai.assert;
- // Uncomment the following line to disable truncating failure messages for deep equals, do:
- // chai.config.truncateThreshold = 0;
- // Since Node 12, we no longer include assertions from our deprecated custom test framework by default.
- // Uncomment the following to use the old assertions:
- // const Test = require("@codewars/test-compat");
- describe("Solution", function() {
it("should test for something", function() {- it("проверка на разных a и b", function() {
- // Test.assertEquals(1 + 1, 2);
- assert.strictEqual(sumNechet(0,5),9);
- assert.strictEqual(sumNechet(0,15),64);
- });
- it("фнкция нечетное вызывается в функции sumNechet", function() {
- assert.strictEqual(sumNechet.toString().includes("нечетное"),true);
- });
- });
function addArr(arr){ return arr.length?arr.reduce((a,e)=>a + e,0):null; }
- function addArr(arr){
if(arr.length === 0) return nulllet final = 0arr.forEach(num => {final += num})return final- return arr.length?arr.reduce((a,e)=>a + e,0):null;
- }
const chai = require("chai"); const assert = chai.assert; describe("Solution", function() { it("should test for something", function() { assert.strictEqual(addArr([1, 2, 3, 4, 5]), 15); assert.strictEqual(addArr([1, 100]), 101) assert.strictEqual(addArr([]), null) }); });
- const chai = require("chai");
- const assert = chai.assert;
- describe("Solution", function() {
- it("should test for something", function() {
- assert.strictEqual(addArr([1, 2, 3, 4, 5]), 15);
- assert.strictEqual(addArr([1, 100]), 101)
- assert.strictEqual(addArr([]), null)
- });
- });