How to use OR operator

I am trying to use an OR operator and the main thing is no matter which one is true (the first or second one). The codes should not be executed.

	function addSingleToAlbum(id, single) {
		let album = new Item(id, single);

		// check duplicates by iterating 
		for (let i in favorite) {
			console.log('song.length ' + song.length);
			console.log('song[i].id !== id ' + song[i].id !== id);
			if(song.length < 5 || song[i].id !== id  ) {
				if(song === null) {
    				song = [];
			console.log('id is the same and length is bigger than 5');

So in other words if the song length is bigger than 5 or if the song id is the sameā€¦the push method should not be executed.

Compare what you said you wanted vs. what you wrote in code.

Also, please use 3 backticks on the line before and the line after any code you post on the forum, so that it properly formats.

if(favorite.length < 10 && !favIds.includes(id)) {

It should be && instead of ||, because when you use the OR operator both need to be falsey which did not happen all the time.