« first day (2546 days earlier)      last day (1571 days later) » 

09:33
Can anybody help me to sort out a problem
I have 3 paragraphs and when I click on each paragraph then these paragraphs must be stored into an array.
function makeSelection(e) {


var test =[];

for(var i=0; i<e.children[0].length){

test.push()
}


}
<a href="#" onclick="makeSelection()"><p>This is P1</p></a>
<a href="#" onclick="makeSelection()"><p>This is P2</p></a>
<a href="#" onclick="makeSelection()"><p>This is P3</p></a>
1 message moved from JavaScript
 
3 hours later…
12:36
I am trying to spy on my code. My code is given below:

// Generator.js
// not working
const { randomNumber } = require("../helpers/util")

// working
const helper = require("../helpers/util")


const integerGenerator = () => {
// working
// return helper.randomNumber();

// not working
return randomNumber(max, min);
};

// Generator.test.js
const sandbox = sinon.createSandbox();

beforeEach(() => {
sandbox.spy(helper, "randomNumberGenerator");
});

afterEach(() => {
sandbox.restore();
});
1 message moved from JavaScript
// Generator.js
// not working
const { randomNumber } = require("../helpers/util");

// working
const helper = require("../helpers/util")

const integerGenerator = () => {
// working
// return helper.randomNumber();

// not working
return randomNumber();
}

// Generator.test.js
sandbox.spy(helper, "randomNumberGenerator");
const result = generator.integer()
expect(helper.randomNumberGenerator).to.have.been.called;
1 message moved from JavaScript
13:37
var jQuery = require('jquery')(window);

describe('Wrap all object method', function() {
var sandbox = sinon.createSandbox();

beforeEach(function() {
sandbox.spy(jQuery);
});

afterEach(function() {
sandbox.restore();
});

it("should inspect jQuery.getJSON's usage of jQuery.ajax", function () {
var url = "https://jsonplaceholder.typicode.com/todos/1";
jQuery.getJSON(url);

assert(jQuery.ajax.calledOnce);
assert.equals(url, jQuery.ajax.getCall(0).args[0].url);
assert.equals("json", jQuery.ajax.getCall(0).args[0].dataType);
1 message moved from JavaScript
 
7 hours later…
 
1 hour later…

« first day (2546 days earlier)      last day (1571 days later) »