javascript: given a search string, you get all the results of movies from the api

They told me that this code was "weird" and did not pass the coding test. I tried to separate to show the different levels of abstraction, but maybe I went overboard? I told them this in the course of the code, since things like the registry of the console would be something more like saving in the database or something more complex, so it is their own abstraction.

const https = require (& # 39; https & # 39;);
/ *
* Complete the function below.
* Use console.log to print the result, you must not return from the function.
* Base url: https://jsonmock.hackerrank.com/api/movies/search/?Title=
* /
asynchronous function getMovieTitles (substr) {

// get the results of the first page
results const = await fetchMoviePage (substr, 1);
leave matches = results.data.map (extractMovieTitle);

// base case - if we only have one page of results, then we have finished here
yes (results.pages_total === 1) {
return sortAndPrintResults (matches);
}

// fill an array of incremented integers from page 2 to the last page
const pages = fillRange (2, results.total_pages);

// for each page obtain data and add them to the results list
waiting (page page const) {
const {data} = await fetchMoviePage (substr, page);
matches = matches.concat (data.map (extractMovieTitle));
}

sortAndPrintResults (matches);
}

/ **
* send ordered results to the standard output
* /
sortAndPrintResults function (results) {
console.log (results.sort (). join (& # 39;  n & # 39;));
}

/ **
* Get a page of movie results.
* /
asynchronous function fetchMoviePage (substr, page) {
try {
return await fetchMatchingMovies (substr, page);

} catch (error) {
console.log (`Error retrieving movies for $ {substr} on page $ {page}: $ {error}`);
returns {data:[]};
}
}

/ **
* Fill an array of incremented integers from start to finish
* /
fillRange function (start, end) {
return Array (end - start + 1) .fill (). map ((item, index) => start + index);
};

/ **
* returns the title of the movie from a movie object
* /
feature extractMovieTitle (movie) {
return movie.title;
}

/ **
* Search a list of movies that match a search string
* /
fetchMatchingMovies (searchString, page) function {
const queryString = `https://jsonmock.hackerrank.com/api/movies/search/?Title=$ {searchString} & page = $ {page}`;

return new promise ((solve, reject) => {

https.get (queryString, res => {
leave data = & # 39; & # 39 ;;
res.on (& # 39; data & # 39 ;, chunk => data + = chunk);
res.on (& # 39; end & # 39 ;, () => resolve (JSON.parse (data)));

}). in (& # 39; error & # 39 ;, e => reject (e));
});
}