# How to get the difference between two arrays in JavaScript?

Is there a way to return the difference between two arrays in JavaScript?

For example:

`var a1 = ['a', 'b']; var a2 = ['a', 'b', 'c', 'd']; // need ["c", "d"] `

Is there a way to return the difference between two arrays in JavaScript?

For example:

`var a1 = ['a', 'b']; var a2 = ['a', 'b', 'c', 'd']; // need ["c", "d"] `

Is there a way to return the difference between two arrays in JavaScript?

For example:

`var a1 = ['a', 'b']; var a2 = ['a', 'b', 'c', 'd']; // need ["c", "d"] `

Is there a way to return the difference between two arrays in JavaScript?

For example:

`var a1 = ['a', 'b']; var a2 = ['a', 'b', 'c', 'd']; // need ["c", "d"] `

Is there a way to return the difference between two arrays in JavaScript?

For example:

`var a1 = ['a', 'b']; var a2 = ['a', 'b', 'c', 'd']; // need ["c", "d"] `

Is there a way to return the difference between two arrays in JavaScript?

For example:

`var a1 = ['a', 'b']; var a2 = ['a', 'b', 'c', 'd']; // need ["c", "d"] `

Is there a way to return the difference between two arrays in JavaScript?

For example:

`var a1 = ['a', 'b']; var a2 = ['a', 'b', 'c', 'd']; // need ["c", "d"] `

Is there a way to return the difference between two arrays in JavaScript?

For example:

`var a1 = ['a', 'b']; var a2 = ['a', 'b', 'c', 'd']; // need ["c", "d"] `

Is there a way to return the difference between two arrays in JavaScript?

For example:

`var a1 = ['a', 'b']; var a2 = ['a', 'b', 'c', 'd']; // need ["c", "d"] `

Is there a way to return the difference between two arrays in JavaScript?

For example:

`var a1 = ['a', 'b']; var a2 = ['a', 'b', 'c', 'd']; // need ["c", "d"] `

Is there a way to return the difference between two arrays in JavaScript?

For example:

`var a1 = ['a', 'b']; var a2 = ['a', 'b', 'c', 'd']; // need ["c", "d"] `