Need help! with javascript coding

Im creating a website and im trying to dropdown filter but the second dropdown option doesnt filter the objects when it has 2 items in dropdown.

heres the code…

import wixData from 'wix-data';

$w.onReady(function () {

	uniqueDropDown1();

});

function uniqueDropDown1() {

	wixData.query("Courses")

		.limit(1000)

		.find()

		.then(results => {

			const uniqueTitles = getUniqueTitles(results.items);

			$w("#dropdownprovince1").options = buildOptions(uniqueTitles);

		});

	function getUniqueTitles(items) {

		const titlesOnly = items.map(item => item.province);

		return [...new Set(titlesOnly)];

	}

	function buildOptions(uniqueList) {

		return uniqueList.map(curr => {

			return { label: curr, value: curr };

		});

	}

}

export function dropdown1_change(event, $w) {

	uniqueDropDown2();

	$w("#dropdowncity2").enable();

}

function uniqueDropDown2() {

	wixData.query("Courses")

		.contains("province", $w("#dropdownprovince1").value)

		.limit(1000)

		.find()

		.then(results => {

			const uniqueTitles = getUniqueTitles(results.items);

			$w("#dropdowncity2").options = buildOptions(uniqueTitles);

			console.log("Dataset is now filtered");
			$w("#listRepeater").data = results.items;
		}).catch((err) => {
			console.log(err);

		});
	$w("#listRepeater").expand();

	function getUniqueTitles(items) {

		const titlesOnly = items.map(item => item.city);

		return [...new Set(titlesOnly)];

	}

	function buildOptions(uniqueList) {

		return uniqueList.map(curr => {

			return { label: curr, value: curr };

		});

	}

}

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).