Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update index.js #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 9 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
'use strict';

module.exports = function diff(arr/*, arrays*/) {
var len = arguments.length;
var idx = 0;
if(!Array.isArray(arr)) return arr;

var len = arguments.length,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a ; at the end of the line.

BlackHole1 marked this conversation as resolved.
Show resolved Hide resolved
ldx = 0;
while (++idx < len) {
arr = diffArray(arr, arguments[idx]);
}
Expand All @@ -20,11 +22,11 @@ function diffArray(one, two) {
if (!Array.isArray(two)) {
return one.slice();
}

var tlen = two.length
var olen = one.length;
var idx = -1;
var arr = [];
var olen = one.length,
tlen = two.length,
idx = -1,
arr = [];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this and use the same formatting as the rest of the code.


while (++idx < olen) {
var ele = one[idx];
Expand Down