const isEven = x => x % 2 === 0
function isEven(input) {return input%2===0;}- const isEven = x => x % 2 === 0
const chai = require("chai"); const assert = chai.assert; describe("isEven", function() { it("should be true for 4", function() { assert.strictEqual(isEven(2), true); }); });
const expect = require("chai").expect;describe("Solution", function() {- const chai = require("chai");
- const assert = chai.assert;
- describe("isEven", function() {
- it("should be true for 4", function() {
expect(isEven(4)).to.equal(true);- assert.strictEqual(isEven(2), true);
- });
Simpler and better using an arrow function.
@cadillacgold329 you can call 'greetings' in 'console.log()' if needed.
let name = "ibahm"; const greetings = n => `My name is: ${n}`
function greetings(){let name = "seraph776";return `My name is: ${name}`;}- let name = "ibahm";
- const greetings = n => `My name is: ${n}`
const chai = require("chai"); const assert = chai.assert; describe("greetings", function() { it("test1", function() { assert.strictEqual(greetings(name), `My name is: ibahm`); }); });
- const chai = require("chai");
- const assert = chai.assert;
- describe("greetings", function() {
- it("test1", function() {
assert.strictEqual(greetings(), "My name is: seraph776");- assert.strictEqual(greetings(name), `My name is: ibahm`);
- });
- });
No need to redeclare the variable 'myName'. Simply call the variable instead.