repl.it
@profhall/

comparing lists

Nodejs

No description

fork
loading
Files
  • index.js
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
let list1 = [
	"AVOCADO",
	"RICOTTA_CHEESE",
	"ANISE_SEEDS",
	"AGAVE_SYRUP_MIX"
]

let list2 = [
	"cream cheese",
	"cheese, ricotta",
	"ANISE_SEEDS",
	"AGAVE_SYRUP_MIX",
	10,24,"Hi"
]

function regex (str) {
    return str.replace(/(~|`|!|@|#|$|%|^|&|\*|\(|\)|{|}|\[|\]|;|:|\"|'|<|,|\.|>|\?|\/|\\|\||-|_|\+|=)/g,"")
}
console.log(regex("cheese, ricotta"))
console.log(regex("AGAVE_SYRUP_MIX"))

list3 = list2.filter(val=> {
	return typeof(val) !== "string"
})

console.log(list3)
?