chosen listlengths 2 2 | rejected listlengths 2 2 | score_chosen int64 6 9 | score_rejected int64 1 9 |
|---|---|---|---|
[
{
"content": "Write a JavaScript function that reverses the order of vowels in a given string, preserving their original case. For example, if the input string is 'Hello World', the output should be 'Holle Werld'. The function should also handle special characters and numbers.",
"role": "user"
},
{
... | [
{
"content": "Write a JavaScript function that reverses the order of vowels in a given string, preserving their original case. For example, if the input string is 'Hello World', the output should be 'Holle Werld'. The function should also handle special characters and numbers.",
"role": "user"
},
{
... | 6 | 6 |
[
{
"content": "Write a HTML and JavaScript code that create a form for users to fill out their current address. Ensure the form validates inputs for each field to accommodate only correct address format, and handles potential exceptions gracefully.",
"role": "user"
},
{
"content": "function a0_0x488f... | [
{
"content": "Write a HTML and JavaScript code that create a form for users to fill out their current address. Ensure the form validates inputs for each field to accommodate only correct address format, and handles potential exceptions gracefully.",
"role": "user"
},
{
"content": "<!doctype html>\n<... | 6 | 3 |
[
{
"content": "Construct a component using Vue.js that manifests as a bilingual registration form allowing English and French languages, integrating three discrete input components to facilitate user input for username, password, and email credentials.",
"role": "user"
},
{
"content": "Designing a Vu... | [
{
"content": "Construct a component using Vue.js that manifests as a bilingual registration form allowing English and French languages, integrating three discrete input components to facilitate user input for username, password, and email credentials.",
"role": "user"
},
{
"content": "Designing a Vu... | 8 | 8 |
[
{
"content": "In the given code, write a function that not only reverses a string, but also counts the occurrences of each character in the reversed string. This count should be case-insensitive, meaning that 'A' and 'a' would be considered the same. Your function should return the reversed string along with a ... | [
{
"content": "In the given code, write a function that not only reverses a string, but also counts the occurrences of each character in the reversed string. This count should be case-insensitive, meaning that 'A' and 'a' would be considered the same. Your function should return the reversed string along with a ... | 6 | 6 |
[
{
"content": "Write a JavaScript function that takes two inputs. The inputs could be an integer, floating point number or a string representation of a number. The function should return true if the numeric values of the inputs are equal and false otherwise. The function should also handle edge cases like traili... | [
{
"content": "Write a JavaScript function that takes two inputs. The inputs could be an integer, floating point number or a string representation of a number. The function should return true if the numeric values of the inputs are equal and false otherwise. The function should also handle edge cases like traili... | 9 | 9 |
[
{
"content": "Construct a Javascript program that not only returns the largest element of an array, but also its index. Additionally, your program should be capable of handling multiple arrays that are nested within the main array. These nested arrays should also be scanned for their largest elements and respec... | [
{
"content": "Construct a Javascript program that not only returns the largest element of an array, but also its index. Additionally, your program should be capable of handling multiple arrays that are nested within the main array. These nested arrays should also be scanned for their largest elements and respec... | 9 | 9 |
[
{
"content": "Transform the provided HTML content into an Angular-based web application while maintaining all existing structural elements.\n<html>\n<head>\n <title>TITLE</title>\n</head>\n<body>\n <h1>HEADER</h1>\n <p>Paragraph</p>\n</body>\n</html>",
"role": "user"
},
{
"content": "Firstly, to ... | [
{
"content": "Transform the provided HTML content into an Angular-based web application while maintaining all existing structural elements.\n<html>\n<head>\n <title>TITLE</title>\n</head>\n<body>\n <h1>HEADER</h1>\n <p>Paragraph</p>\n</body>\n</html>",
"role": "user"
},
{
"content": "Firstly, to ... | 9 | 9 |
[
{
"content": "Write JavaScript code to output a square pattern of stars. The number of rows and columns should be determined by user input. Additionally, alternate each row's pattern between stars and numbers incrementing from 1. \n\nFor instance, if the user inputs 5, the output should look like this:\n\n```\n... | [
{
"content": "Write JavaScript code to output a square pattern of stars. The number of rows and columns should be determined by user input. Additionally, alternate each row's pattern between stars and numbers incrementing from 1. \n\nFor instance, if the user inputs 5, the output should look like this:\n\n```\n... | 7 | 7 |
[
{
"content": "Design a JavaScript function that checks if every individual integer within a provided multidimensional array is a prime number or not. Also, the function should flatten the multidimensional array before performing the prime check.",
"role": "user"
},
{
"content": "First let's create a... | [
{
"content": "Design a JavaScript function that checks if every individual integer within a provided multidimensional array is a prime number or not. Also, the function should flatten the multidimensional array before performing the prime check.",
"role": "user"
},
{
"content": "First let's create a... | 8 | 8 |
[
{
"content": "Create a function in Node JS that takes an array of objects and counts the number of elements with a certain property, such as the number of elements with a certain amount of money.\nlet arr = [\n {name: 'John', money: 10},\n {name: 'Mary', money: 20},\n {name: 'Bob', money: 10},\n {name: 'Susan',... | [
{
"content": "Create a function in Node JS that takes an array of objects and counts the number of elements with a certain property, such as the number of elements with a certain amount of money.\nlet arr = [\n {name: 'John', money: 10},\n {name: 'Mary', money: 20},\n {name: 'Bob', money: 10},\n {name: 'Susan',... | 9 | 9 |
[
{
"content": "Revise the following flawed code:\n/*\n primeFib aims to return the nth number that is not only a prime number but also a part of the Fibonacci sequence. However, the current implementation is incorrect.\n >>> primeFib(1)\n 2\n >>> primeFib(2)\n 3\n >>> primeFib(3)\n 5\n >>> primeFib(4)\n ... | [
{
"content": "Revise the following flawed code:\n/*\n primeFib aims to return the nth number that is not only a prime number but also a part of the Fibonacci sequence. However, the current implementation is incorrect.\n >>> primeFib(1)\n 2\n >>> primeFib(2)\n 3\n >>> primeFib(3)\n 5\n >>> primeFib(4)\n ... | 6 | 6 |
[
{
"content": "Using React and Redux, create a Textarea component that can take in text as an input property and render it. The component should also have its state and actions which include:\n\n- Loading a new set of text from an API upon a user event (such as clicking a button).\n- It should manage it's own st... | [
{
"content": "Using React and Redux, create a Textarea component that can take in text as an input property and render it. The component should also have its state and actions which include:\n\n- Loading a new set of text from an API upon a user event (such as clicking a button).\n- It should manage it's own st... | 8 | 8 |
[
{
"content": "Design a NodeJS script that asynchronously calls a remote GraphQL API using a specific query and paginates the results if necessary. Then, convert the aggregated response to a csv object while filtering out unnecessary fields and apply formatting to certain columns if needed.",
"role": "user"
... | [
{
"content": "Design a NodeJS script that asynchronously calls a remote GraphQL API using a specific query and paginates the results if necessary. Then, convert the aggregated response to a csv object while filtering out unnecessary fields and apply formatting to certain columns if needed.",
"role": "user"
... | 7 | 7 |
[
{
"content": "Undertake a thorough examination of the supplied JavaScript code portion, ascertaining its adherence to both the accurate programming syntax and the precise semantic rules:\nfunction add(a, b) { \n const result = a ++ b; \n return result; \n}",
"role": "user"
},
{
"content": "The p... | [
{
"content": "Undertake a thorough examination of the supplied JavaScript code portion, ascertaining its adherence to both the accurate programming syntax and the precise semantic rules:\nfunction add(a, b) { \n const result = a ++ b; \n return result; \n}",
"role": "user"
},
{
"content": "The p... | 8 | 8 |
[
{
"content": "Write a JavaScript program that not only removes all characters from a string that appear more than once, but also returns a new string where remaining unique characters are sorted in reverse alphabetically. \n\nExample:\nGiven the string \"abbccddee\", the program should return \"edcba\". \n\nAdd... | [
{
"content": "Write a JavaScript program that not only removes all characters from a string that appear more than once, but also returns a new string where remaining unique characters are sorted in reverse alphabetically. \n\nExample:\nGiven the string \"abbccddee\", the program should return \"edcba\". \n\nAdd... | 8 | 8 |
[
{
"content": "Convert the following JavaScript code snippet into an Async/Await function that wraps around a Promise using the new Promise constructor. You also need to handle any potential errors appropriately.\n\nfunction checkStatus(response) {\n if (response.status >= 200 && response.status < 300) {\n ... | [
{
"content": "Convert the following JavaScript code snippet into an Async/Await function that wraps around a Promise using the new Promise constructor. You also need to handle any potential errors appropriately.\n\nfunction checkStatus(response) {\n if (response.status >= 200 && response.status < 300) {\n ... | 6 | 6 |
[
{
"content": "Construct a RESTful API utilizing the Node.js environment and Express.js framework. The API should have an endpoint which when accessed, retrieves and calculates not only the mean, but also the median, mode and standard deviation of the heights of all registered members from a specific MySQL datab... | [
{
"content": "Construct a RESTful API utilizing the Node.js environment and Express.js framework. The API should have an endpoint which when accessed, retrieves and calculates not only the mean, but also the median, mode and standard deviation of the heights of all registered members from a specific MySQL datab... | 7 | 7 |
[
{
"content": "Every document has a users array. I want to check in db if a document has in its users array the value -> `['123','456']` OR `['456','123']`, the order doesn't matter but I need that THESE AND ONLY THESE values are present in users array.\nI'm basically looking for something like `set(users.array)... | [
{
"content": "Every document has a users array. I want to check in db if a document has in its users array the value -> `['123','456']` OR `['456','123']`, the order doesn't matter but I need that THESE AND ONLY THESE values are present in users array.\nI'm basically looking for something like `set(users.array)... | 6 | 6 |
[
{
"content": "Write a program in Javascript which uses regular expressions (regex) to identify and extract different types of data (such as emails, phone numbers, URLs, etc.) from a given string. Also, justify your choice of regex grammar for each type.",
"role": "user"
},
{
"content": "In JavaScrip... | [
{
"content": "Write a program in Javascript which uses regular expressions (regex) to identify and extract different types of data (such as emails, phone numbers, URLs, etc.) from a given string. Also, justify your choice of regex grammar for each type.",
"role": "user"
},
{
"content": "In JavaScrip... | 7 | 7 |
[
{
"content": "In JavaScript, create a program for a bank account that tracks a user's balance and it must be able to perform multiple transactions. The program should calculate and display whether the account is solvent (balance >= 0) or insolvent (balance < 0) after each transaction. \n\nStart with an initial ... | [
{
"content": "In JavaScript, create a program for a bank account that tracks a user's balance and it must be able to perform multiple transactions. The program should calculate and display whether the account is solvent (balance >= 0) or insolvent (balance < 0) after each transaction. \n\nStart with an initial ... | 8 | 1 |
[
{
"content": "render the following in javascript:\ndef fruit_distribution(s, n, fruits, servings):\n fruit_dict = {}\n for fruit in s:\n fruit_name, count = fruit.split()\n fruit_dict[fruit_name] = int(count)\n \n for fruit in fruits:\n if fruit in servings:\n n -... | [
{
"content": "render the following in javascript:\ndef fruit_distribution(s, n, fruits, servings):\n fruit_dict = {}\n for fruit in s:\n fruit_name, count = fruit.split()\n fruit_dict[fruit_name] = int(count)\n \n for fruit in fruits:\n if fruit in servings:\n n -... | 8 | 8 |
[
{
"content": "Implement a JavaScript function to find all distinct prime factors of a given number. Additionally, the function should also return the highest power of each prime factor. The function must provide correct results for numbers up to 2^53 - 1 (JavaScript's largest safe integer).\n\nAs a reference, h... | [
{
"content": "Implement a JavaScript function to find all distinct prime factors of a given number. Additionally, the function should also return the highest power of each prime factor. The function must provide correct results for numbers up to 2^53 - 1 (JavaScript's largest safe integer).\n\nAs a reference, h... | 9 | 9 |
[
{
"content": "Craft a JavaScript function that locates the mode within an unordered array of floating-point numbers.",
"role": "user"
},
{
"content": "Here is a JavaScript function that finds the mode in an unordered array of floating point numbers. This function creates a dictionary where the keys ... | [
{
"content": "Craft a JavaScript function that locates the mode within an unordered array of floating-point numbers.",
"role": "user"
},
{
"content": "Here is a JavaScript function that finds the mode in an unordered array of floating point numbers. This function creates a dictionary where the keys ... | 8 | 8 |
[
{
"content": "Compose a JS code that segregates names of fruits, names of animals and names of places into separate arrays from a mixed array. Additionally, implement a function that ranks each array not only in alphabetical order but also by the length of words. If there are two words with the same length, sor... | [
{
"content": "Compose a JS code that segregates names of fruits, names of animals and names of places into separate arrays from a mixed array. Additionally, implement a function that ranks each array not only in alphabetical order but also by the length of words. If there are two words with the same length, sor... | 9 | 9 |
[
{
"content": "Craft a JavaScript function that acquires an array and a specific numeric entity as parameters. This particular routine is tasked to sort the array in ascending sequence and then locate the precise position to weave in the provided number, hence resulting in a restructured array incorporating the ... | [
{
"content": "Craft a JavaScript function that acquires an array and a specific numeric entity as parameters. This particular routine is tasked to sort the array in ascending sequence and then locate the precise position to weave in the provided number, hence resulting in a restructured array incorporating the ... | 7 | 7 |
[
{
"content": "Create an HTML calendar that visualizes the project milestones and deadlines in a layout of 3 different months.\nMilestone1: 7th May 2022\nMilestone2: 14th May 2022\nMilestone3: 15th September 2022\nMilestone4: 22nd September 2022\nMilestone5: 5th December 2022\nMilestone6: 12th December 2022\nMil... | [
{
"content": "Create an HTML calendar that visualizes the project milestones and deadlines in a layout of 3 different months.\nMilestone1: 7th May 2022\nMilestone2: 14th May 2022\nMilestone3: 15th September 2022\nMilestone4: 22nd September 2022\nMilestone5: 5th December 2022\nMilestone6: 12th December 2022\nMil... | 7 | 1 |
[
{
"content": "Design a JavaScript function to convert a given time in 24-hour notation to 12-hour notation. Additionally, handle edge cases (e.g. invalid inputs) and take daylight saving time into consideration if applicable.",
"role": "user"
},
{
"content": "Here's a JavaScript function that conver... | [
{
"content": "Design a JavaScript function to convert a given time in 24-hour notation to 12-hour notation. Additionally, handle edge cases (e.g. invalid inputs) and take daylight saving time into consideration if applicable.",
"role": "user"
},
{
"content": "Here's a JavaScript function that conver... | 8 | 1 |
[
{
"content": "Develop a computational tool utilizing JavaScript, which executes not only elementary arithmetic operations like summation, subtraction, multiplication, and division, but also manages intricate functions such as square root extraction, exponentiation, and factorial computation. Incorporate error m... | [
{
"content": "Develop a computational tool utilizing JavaScript, which executes not only elementary arithmetic operations like summation, subtraction, multiplication, and division, but also manages intricate functions such as square root extraction, exponentiation, and factorial computation. Incorporate error m... | 9 | 9 |
[
{
"content": "Develop a JavaScript program that validates a HTML form that collects 7 user details: full name, national identification number (applicable to country of choice), birth date in ISO 8601 format, mobile number with international dialing code, street address that adheres to USPS address formatting, e... | [
{
"content": "Develop a JavaScript program that validates a HTML form that collects 7 user details: full name, national identification number (applicable to country of choice), birth date in ISO 8601 format, mobile number with international dialing code, street address that adheres to USPS address formatting, e... | 8 | 2 |
[
{
"content": "Given the following piece of erroneous code, identify the errors and refactor the function. The function accepts an argument in the form of a string data type. Additionally, the refactored function should handle edge cases of null and undefined inputs.\n\n```javascript\nlet faultyFunction = new fu... | [
{
"content": "Given the following piece of erroneous code, identify the errors and refactor the function. The function accepts an argument in the form of a string data type. Additionally, the refactored function should handle edge cases of null and undefined inputs.\n\n```javascript\nlet faultyFunction = new fu... | 7 | 7 |
[
{
"content": "Refine and amend the following JavaScript code snippet to obtain the cumulative total of elements within a multidimensional array. Consider arrays with both different lengths and nested arrays while implementing your solution.\n\nlet numbers = [[1, 2, 3], [4, 5], [6, 7, 8, 9]]",
"role": "user"... | [
{
"content": "Refine and amend the following JavaScript code snippet to obtain the cumulative total of elements within a multidimensional array. Consider arrays with both different lengths and nested arrays while implementing your solution.\n\nlet numbers = [[1, 2, 3], [4, 5], [6, 7, 8, 9]]",
"role": "user"... | 6 | 6 |
[
{
"content": "Perfect the subsequent cipher. Providentially, it's positing a dictionary. The mission is to gauge if every key within stems from uniform case strings---exclusively lowercase or uppercase. Affirmatively, it should manifest 'true'. Incorporate a dissenting outcome if keys deviate from this uniformi... | [
{
"content": "Perfect the subsequent cipher. Providentially, it's positing a dictionary. The mission is to gauge if every key within stems from uniform case strings---exclusively lowercase or uppercase. Affirmatively, it should manifest 'true'. Incorporate a dissenting outcome if keys deviate from this uniformi... | 8 | 4 |
[
{
"content": "Write a JavaScript program to search a given element x in a randomly sorted array and return the indices of all occurrences. The array can contain duplicate elements.\narr = [1, 8, 2, 8, 4, 10];\nx = 8",
"role": "user"
},
{
"content": "You can solve this problem by using a simple loop ... | [
{
"content": "Write a JavaScript program to search a given element x in a randomly sorted array and return the indices of all occurrences. The array can contain duplicate elements.\narr = [1, 8, 2, 8, 4, 10];\nx = 8",
"role": "user"
},
{
"content": "You can solve this problem by using a simple loop ... | 7 | 7 |
[
{
"content": "Formulate a MongoDB query to retrieve every document from a specified multi-collection database where the attribute \"date\" correlates with the current day's date, and additionally sort these results by another attribute \"priority\" in descending order.",
"role": "user"
},
{
"content... | [
{
"content": "Formulate a MongoDB query to retrieve every document from a specified multi-collection database where the attribute \"date\" correlates with the current day's date, and additionally sort these results by another attribute \"priority\" in descending order.",
"role": "user"
},
{
"content... | 8 | 8 |
[
{
"content": "Refactor the following JavaScript program to not only use the map() and filter() methods of ES6, but also incorporate the reduce() method. Consider potential edge cases for a broader variety of inputs, for example, handling arrays that contain non-integer values and nested arrays.\n\nAdditionally,... | [
{
"content": "Refactor the following JavaScript program to not only use the map() and filter() methods of ES6, but also incorporate the reduce() method. Consider potential edge cases for a broader variety of inputs, for example, handling arrays that contain non-integer values and nested arrays.\n\nAdditionally,... | 7 | 3 |
[
{
"content": "Develop a Node.js web server that accepts a PATCH request with JSON payload, transforms the input into an HTML syntax according to a specific mapping logic, and returns a client-side JavaScript rendering of the corresponding HTML page. The server should also handle errors gracefully and have unit ... | [
{
"content": "Develop a Node.js web server that accepts a PATCH request with JSON payload, transforms the input into an HTML syntax according to a specific mapping logic, and returns a client-side JavaScript rendering of the corresponding HTML page. The server should also handle errors gracefully and have unit ... | 9 | 9 |
[
{
"content": "Given the following piece of erroneous JavaScript code, correctly create a new <div> HTML entity, attach it to the Document Object Model, and assign it an id of \"main-container\". Your revised code should handle potential exceptions and validate the DOM manipulation process properly. \n\n```javas... | [
{
"content": "Given the following piece of erroneous JavaScript code, correctly create a new <div> HTML entity, attach it to the Document Object Model, and assign it an id of \"main-container\". Your revised code should handle potential exceptions and validate the DOM manipulation process properly. \n\n```javas... | 6 | 6 |
[
{
"content": "In the process of initializing my AWS Lambda function, I stumble upon an 'Internal Server Error'. Can you expound on the comprehensive procedure for setting up a serverless function using AWS Lambda, specifically designed for a Node.js runtime environment, to circumvent these technological impedim... | [
{
"content": "In the process of initializing my AWS Lambda function, I stumble upon an 'Internal Server Error'. Can you expound on the comprehensive procedure for setting up a serverless function using AWS Lambda, specifically designed for a Node.js runtime environment, to circumvent these technological impedim... | 9 | 9 |
[
{
"content": "Write a function in JavaScript that takes multiple arrays, not just two, and merges them into a single array. Ensure that the merged array is sorted in ascending order without using any built-in sort functions. Additionally, the function should eliminate any duplicated values, if they exist, in th... | [
{
"content": "Write a function in JavaScript that takes multiple arrays, not just two, and merges them into a single array. Ensure that the merged array is sorted in ascending order without using any built-in sort functions. Additionally, the function should eliminate any duplicated values, if they exist, in th... | 9 | 9 |
[
{
"content": "Develop a MongoDB search command that also accounts for case sensitivity and will accumulate all the data records in which the 'name' attribute encompasses the provided character sequence, in reverse order based on creation date. Exempt entries where the 'status' is 'inactive'. Character sequence:... | [
{
"content": "Develop a MongoDB search command that also accounts for case sensitivity and will accumulate all the data records in which the 'name' attribute encompasses the provided character sequence, in reverse order based on creation date. Exempt entries where the 'status' is 'inactive'. Character sequence:... | 9 | 4 |
[
{
"content": "Create a switch statement that outputs distinctive messages for distinct academic classifications and includes course difficulty level, utilizing the variables \"grade\" and \"courseDifficulty\" as references. Implement error handling for invalid inputs.\nvar grade = \"A+\";\nvar courseDifficulty ... | [
{
"content": "Create a switch statement that outputs distinctive messages for distinct academic classifications and includes course difficulty level, utilizing the variables \"grade\" and \"courseDifficulty\" as references. Implement error handling for invalid inputs.\nvar grade = \"A+\";\nvar courseDifficulty ... | 9 | 9 |
[
{
"content": "Construct a JavaScript function that relocates all null entities to the start of the supplied array, while maintaining the relative sequence of the non-null elements. This function should also be proficient in managing multi-dimensional arrays and shift all null entities in the nested arrays to th... | [
{
"content": "Construct a JavaScript function that relocates all null entities to the start of the supplied array, while maintaining the relative sequence of the non-null elements. This function should also be proficient in managing multi-dimensional arrays and shift all null entities in the nested arrays to th... | 9 | 9 |
[
{
"content": "I am using the function below to match URLs inside a given text and replace them for HTML links. The regular expression is working great, but currently I am only replacing the first match.\n\nHow I can replace all the URL? I guess I should be using the command, but I did not really figure how to ... | [
{
"content": "I am using the function below to match URLs inside a given text and replace them for HTML links. The regular expression is working great, but currently I am only replacing the first match.\n\nHow I can replace all the URL? I guess I should be using the command, but I did not really figure how to ... | 6 | 6 |
[
{
"content": "Can you detail the process of implementing error handling in JavaScript, explaining its necessity and illustrating how one might classify, catch and recover from different classes of errors?",
"role": "user"
},
{
"content": "Error handling in JavaScript is an essential part of programm... | [
{
"content": "Can you detail the process of implementing error handling in JavaScript, explaining its necessity and illustrating how one might classify, catch and recover from different classes of errors?",
"role": "user"
},
{
"content": "Error handling in JavaScript is an essential part of programm... | 6 | 6 |
[
{
"content": "How do I make a user's browser blink/flash/highlight in the task bar using JavaScript? For example, if I make an AJAX request every 10 seconds to see if the user has any new messages on the server, I want the user to know it right away, even if he is using another application at the time.",
"r... | [
{
"content": "How do I make a user's browser blink/flash/highlight in the task bar using JavaScript? For example, if I make an AJAX request every 10 seconds to see if the user has any new messages on the server, I want the user to know it right away, even if he is using another application at the time.",
"r... | 7 | 7 |
[
{
"content": "Devise a programming script to finalize the below mentioned function:\n/*Enumerate the cumulative sum of all elements from the Fibonacci sequence that are smaller than n, divisible by 3 or 5, and their units place ends in either 3 or 7.\n >>> fibonacciSum(50)\n 20\n >>> fibonacciSum(70)\n 33\n... | [
{
"content": "Devise a programming script to finalize the below mentioned function:\n/*Enumerate the cumulative sum of all elements from the Fibonacci sequence that are smaller than n, divisible by 3 or 5, and their units place ends in either 3 or 7.\n >>> fibonacciSum(50)\n 20\n >>> fibonacciSum(70)\n 33\n... | 8 | 8 |
[
{
"content": "Write a JavaScript program that takes a two-dimensional array as input and prints its contents in a spiral order (from the top right-hand corner, moving clockwise). \n\nFor instance, for an input of [['Hello','World','!'],['How','Are','You']], the output should be: ['!', 'World', 'Hello', 'How', '... | [
{
"content": "Write a JavaScript program that takes a two-dimensional array as input and prints its contents in a spiral order (from the top right-hand corner, moving clockwise). \n\nFor instance, for an input of [['Hello','World','!'],['How','Are','You']], the output should be: ['!', 'World', 'Hello', 'How', '... | 6 | 6 |
[
{
"content": "Inferring the succeeding JavaScript object representing an enclosed secondary array, formulate a progressively intricate sequential procedure that eliminates every distinct elements contained within this hierarchical structure.\nconst obj = { data: [6, 7, 8, 9, 10] };",
"role": "user"
},
{... | [
{
"content": "Inferring the succeeding JavaScript object representing an enclosed secondary array, formulate a progressively intricate sequential procedure that eliminates every distinct elements contained within this hierarchical structure.\nconst obj = { data: [6, 7, 8, 9, 10] };",
"role": "user"
},
{... | 7 | 2 |
[
{
"content": "Immerse yourself further into the complex realm of WebGL programming, accentuating the less frequently utilized techniques such as texture mapping, bump mapping, and environment mapping. Construct a code fragment that exemplifies the utilization of each, with a particular concentration on the mani... | [
{
"content": "Immerse yourself further into the complex realm of WebGL programming, accentuating the less frequently utilized techniques such as texture mapping, bump mapping, and environment mapping. Construct a code fragment that exemplifies the utilization of each, with a particular concentration on the mani... | 7 | 7 |
[
{
"content": "In JavaScript, design a class that will not only incorporate variables but also provide methods that carry out various computations. One such method should calculate the result of the formula a + 5*b which involves variables 'a' and 'b' initialized through the constructor of the class. This method... | [
{
"content": "In JavaScript, design a class that will not only incorporate variables but also provide methods that carry out various computations. One such method should calculate the result of the formula a + 5*b which involves variables 'a' and 'b' initialized through the constructor of the class. This method... | 7 | 7 |
[
{
"content": "Construct a JavaScript function capable of transforming a multi-tier JSON structure into a hierarchically organized HTML table. The function must possess the sophistication to deftly manage undefined entities. Proceed with this JSON structure as your working model:\njson = {\n \"person\": {\n \"... | [
{
"content": "Construct a JavaScript function capable of transforming a multi-tier JSON structure into a hierarchically organized HTML table. The function must possess the sophistication to deftly manage undefined entities. Proceed with this JSON structure as your working model:\njson = {\n \"person\": {\n \"... | 9 | 9 |
[
{
"content": "Create a function in Javascript that not only validates a user input as a valid email address but also checks that the email address's domain is from a specified list of valid domains. The function must also reject any email address with more than 25 characters, including the @ symbol and domain, ... | [
{
"content": "Create a function in Javascript that not only validates a user input as a valid email address but also checks that the email address's domain is from a specified list of valid domains. The function must also reject any email address with more than 25 characters, including the @ symbol and domain, ... | 7 | 7 |
[
{
"content": "Can you explain how hoisting works in JavaScript in relation to both variables and function declarations? Provide two distinct examples where it may lead to unexpected results, one involving variable hoisting and the other function hoisting. Additionally, explain how ES6 `let` and `const` declarat... | [
{
"content": "Can you explain how hoisting works in JavaScript in relation to both variables and function declarations? Provide two distinct examples where it may lead to unexpected results, one involving variable hoisting and the other function hoisting. Additionally, explain how ES6 `let` and `const` declarat... | 7 | 7 |
[
{
"content": "Construct a general JavaScript function that can take in the side lengths (including non-integer lengths) of any isosceles trapezoid. Also, it should handle erroneous inputs by returning an error message.\n\nThe function should take four arguments - the lengths of each side - with considerations a... | [
{
"content": "Construct a general JavaScript function that can take in the side lengths (including non-integer lengths) of any isosceles trapezoid. Also, it should handle erroneous inputs by returning an error message.\n\nThe function should take four arguments - the lengths of each side - with considerations a... | 9 | 4 |
[
{
"content": "Design and propose a RESTful API endpoint linked to user profile data management within a complex web-based application system, inclusive of user authentication and data encryption. \n\nAdditionally, you are required to troubleshoot an erroneous code provided below related to the user profile endp... | [
{
"content": "Design and propose a RESTful API endpoint linked to user profile data management within a complex web-based application system, inclusive of user authentication and data encryption. \n\nAdditionally, you are required to troubleshoot an erroneous code provided below related to the user profile endp... | 6 | 6 |
[
{
"content": "Generate a complete JavaScript code that calls fetch() API with a certain URL (https://www.example.com) and incorporates exception handling. Also, use async/await for handling promises and customise the headers in the fetch request according to the following criteria:\n1. Use 'application/json' as... | [
{
"content": "Generate a complete JavaScript code that calls fetch() API with a certain URL (https://www.example.com) and incorporates exception handling. Also, use async/await for handling promises and customise the headers in the fetch request according to the following criteria:\n1. Use 'application/json' as... | 7 | 7 |
[
{
"content": "Craft a JavaScript code snippet that meticulously sieves through a two-dimensional array consisting of integers from 1 to 6, eliminating the even integers and returning only the odd ones, while maintaining the original nested array structure. [1,2,3,4,5,6] should return [[1,3,5],[],[]].",
"rol... | [
{
"content": "Craft a JavaScript code snippet that meticulously sieves through a two-dimensional array consisting of integers from 1 to 6, eliminating the even integers and returning only the odd ones, while maintaining the original nested array structure. [1,2,3,4,5,6] should return [[1,3,5],[],[]].",
"rol... | 6 | 1 |
[
{
"content": "i'm moving my project to javascript, translate this code:\ndef count_up_to(n):\n def check_primality(num):\n if num <= 1:\n return False\n elif num <= 3:\n return True\n elif num % 2 == 0 or num % 3 == 0:\n return False\n i = 5\n ... | [
{
"content": "i'm moving my project to javascript, translate this code:\ndef count_up_to(n):\n def check_primality(num):\n if num <= 1:\n return False\n elif num <= 3:\n return True\n elif num % 2 == 0 or num % 3 == 0:\n return False\n i = 5\n ... | 6 | 6 |
[
{
"content": "Develop a directive with the use of the Vue.js framework that carries out the task of manipulating the data attribute labeled \"userStatus\". The alteration of this attribute should be dependent on the \"status\" query parameter. This parameter is established by extracting it from the existing Uni... | [
{
"content": "Develop a directive with the use of the Vue.js framework that carries out the task of manipulating the data attribute labeled \"userStatus\". The alteration of this attribute should be dependent on the \"status\" query parameter. This parameter is established by extracting it from the existing Uni... | 7 | 7 |
[
{
"content": "Given a JavaScript function which uses the `sort()` array method incorrectly, identify the error in the code and explain what the sort function is actually supposed to accomplish.\n\nConsider the following JavaScript code snippet:\n\n```javascript\nlet arr = [10, 5, 8, 1, 7];\narr.sort();\nconsole... | [
{
"content": "Given a JavaScript function which uses the `sort()` array method incorrectly, identify the error in the code and explain what the sort function is actually supposed to accomplish.\n\nConsider the following JavaScript code snippet:\n\n```javascript\nlet arr = [10, 5, 8, 1, 7];\narr.sort();\nconsole... | 8 | 1 |
[
{
"content": "Develop a JavaScript form that accepts international phone numbers as input and not just local ones. The form should be capable of recognizing and validating the country code and the format of the input. Upon successful validation, it should display a \"Success\" message and the country of origin ... | [
{
"content": "Develop a JavaScript form that accepts international phone numbers as input and not just local ones. The form should be capable of recognizing and validating the country code and the format of the input. Upon successful validation, it should display a \"Success\" message and the country of origin ... | 8 | 2 |
[
{
"content": "Given a faulty JavaScript function, refine and correct it so it accurately computes and handles outliers in the median of meteorological readings from a supplied array of daily atmospheric temperature data. The array may include erroneous data recordings that deviate greatly from the day's average... | [
{
"content": "Given a faulty JavaScript function, refine and correct it so it accurately computes and handles outliers in the median of meteorological readings from a supplied array of daily atmospheric temperature data. The array may include erroneous data recordings that deviate greatly from the day's average... | 8 | 8 |
[
{
"content": "Design a function in JavaScript that calculates and outputs the median value of temperature data, which is involved within a given array of daily temperatures, including the situations when the dataset stands with an odd and even number of temperature readings.",
"role": "user"
},
{
"c... | [
{
"content": "Design a function in JavaScript that calculates and outputs the median value of temperature data, which is involved within a given array of daily temperatures, including the situations when the dataset stands with an odd and even number of temperature readings.",
"role": "user"
},
{
"c... | 9 | 9 |
[
{
"content": "How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures themselves?\n\nI have seen [the Scheme example](http://en.wikipedia.org/wiki/Scheme_%28programming_language%29) gi... | [
{
"content": "How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures themselves?\n\nI have seen [the Scheme example](http://en.wikipedia.org/wiki/Scheme_%28programming_language%29) gi... | 7 | 7 |
[
{
"content": "Implement a SHA-256 hash function in JavaScript to hash a given string. However, instead of just hashing a single string, generalize the function to be able to hash an array of strings. Each string should be hashed separately, and the function should return an array of hashed strings. Additionally... | [
{
"content": "Implement a SHA-256 hash function in JavaScript to hash a given string. However, instead of just hashing a single string, generalize the function to be able to hash an array of strings. Each string should be hashed separately, and the function should return an array of hashed strings. Additionally... | 6 | 6 |
[
{
"content": "Develop an enhanced version of the given JavaScript code segment that follows the \"Don't Repeat Yourself\" (DRY) principle more rigidly. Additionally, add functionality to calculate the total calories of an arbitrary list of fruits. The number of calories for each type of fruit is as follows: \n\... | [
{
"content": "Develop an enhanced version of the given JavaScript code segment that follows the \"Don't Repeat Yourself\" (DRY) principle more rigidly. Additionally, add functionality to calculate the total calories of an arbitrary list of fruits. The number of calories for each type of fruit is as follows: \n\... | 6 | 6 |
[
{
"content": "Using JavaScript, create a WebSocket server in Node.js. Also, implement an advanced connection establishment method to create a connection with an SVG Graphics element, and develop a mechanism for sending and broadcasting JSON messages. The setup should not only support sending and receiving messa... | [
{
"content": "Using JavaScript, create a WebSocket server in Node.js. Also, implement an advanced connection establishment method to create a connection with an SVG Graphics element, and develop a mechanism for sending and broadcasting JSON messages. The setup should not only support sending and receiving messa... | 6 | 1 |
[
{
"content": "Classify the term \"function\" as a programming language feature and analyze the given erroneous code snippet to identify and correct the mistakes.\n\n```javascript\nfunction calculate_sum(a, b)\n var sum = 0;\n sum = a + b,\n return sum\n}\n\nconst result = calculate_sum(5; 8);\nconsole.... | [
{
"content": "Classify the term \"function\" as a programming language feature and analyze the given erroneous code snippet to identify and correct the mistakes.\n\n```javascript\nfunction calculate_sum(a, b)\n var sum = 0;\n sum = a + b,\n return sum\n}\n\nconst result = calculate_sum(5; 8);\nconsole.... | 8 | 8 |
[
{
"content": "Given the id of an element I need to make a query in javascript, for example:\n\njavascript:\n var post_value = $(\".post\").val() # return a post ID;\n var post = #{Post.find_by(id: post_value).to_json.html_safe};\n\n\nBut the variable don't recognize it\nIf I manually pass a value to it, it r... | [
{
"content": "Given the id of an element I need to make a query in javascript, for example:\n\njavascript:\n var post_value = $(\".post\").val() # return a post ID;\n var post = #{Post.find_by(id: post_value).to_json.html_safe};\n\n\nBut the variable don't recognize it\nIf I manually pass a value to it, it r... | 7 | 3 |
[
{
"content": "Design a JavaScript function that transforms an array of hexadecimal string representations into an array of decimal integer equivalents. The function should also manage incorrect hexadecimal strings and return an error message for those. Furthermore, provide a piece of incorrect code that tries t... | [
{
"content": "Design a JavaScript function that transforms an array of hexadecimal string representations into an array of decimal integer equivalents. The function should also manage incorrect hexadecimal strings and return an error message for those. Furthermore, provide a piece of incorrect code that tries t... | 6 | 6 |
[
{
"content": "Develop a JavaScript program that dynamically creates a multi-tier cascading menu with sub-menu items. Each menu item should be a button with unique IDs, and the color of the buttons should gradually change from red to blue based on the tier level. Furthermore, the text on the button should reflec... | [
{
"content": "Develop a JavaScript program that dynamically creates a multi-tier cascading menu with sub-menu items. Each menu item should be a button with unique IDs, and the color of the buttons should gradually change from red to blue based on the tier level. Furthermore, the text on the button should reflec... | 8 | 8 |
[
{
"content": "Compose a succinct JavaScript function which utilizes regular expressions to carry out a meticulous verification procedure for a North American phone number, ensuring adherence to NANP (North American Numbering Plan) standards.",
"role": "user"
},
{
"content": "Here is a JavaScript fun... | [
{
"content": "Compose a succinct JavaScript function which utilizes regular expressions to carry out a meticulous verification procedure for a North American phone number, ensuring adherence to NANP (North American Numbering Plan) standards.",
"role": "user"
},
{
"content": "Here is a JavaScript fun... | 6 | 6 |
[
{
"content": "Create a JavaScript function that receives an array of hexadecimal numbers. The function should convert each hexadecimal number into its octal representation. Additionally, if duplicate octal numbers result from the conversion, your function should calculate and return the sum of the duplicate oct... | [
{
"content": "Create a JavaScript function that receives an array of hexadecimal numbers. The function should convert each hexadecimal number into its octal representation. Additionally, if duplicate octal numbers result from the conversion, your function should calculate and return the sum of the duplicate oct... | 8 | 8 |
[
{
"content": "Construct a React component that embodies a three-state toggle switch, unlike a binary input system. This tri-state toggle should include an \"undefined\" state as well. The initial state, i.e., before user interaction, should be \"undefined\". Furthermore, enhance the component to accept props th... | [
{
"content": "Construct a React component that embodies a three-state toggle switch, unlike a binary input system. This tri-state toggle should include an \"undefined\" state as well. The initial state, i.e., before user interaction, should be \"undefined\". Furthermore, enhance the component to accept props th... | 7 | 2 |
[
{
"content": "Can you provide a Javascript interpretation of this?\n#include<stdio.h>\n#include<map>\n#include<vector>\nusing namespace std;\n\nenum Operation {\n DEPOSIT = 0,\n WITHDRAWAL = 1,\n INTEREST = 2\n};\n\nmap<int, int> below_zero(vector<vector<int>> operations, vector<int> initial_balances) ... | [
{
"content": "Can you provide a Javascript interpretation of this?\n#include<stdio.h>\n#include<map>\n#include<vector>\nusing namespace std;\n\nenum Operation {\n DEPOSIT = 0,\n WITHDRAWAL = 1,\n INTEREST = 2\n};\n\nmap<int, int> below_zero(vector<vector<int>> operations, vector<int> initial_balances) ... | 6 | 3 |
[
{
"content": "Formulate a JavaScript object to preserve the appellations and their corresponding scientific designations of three distinct avian species:\n\nOwl - Strigidae\nDove - Columbidae\nEagle - Accipitridae\n\nAdditionally, each species object should contain another object named 'characteristics', with t... | [
{
"content": "Formulate a JavaScript object to preserve the appellations and their corresponding scientific designations of three distinct avian species:\n\nOwl - Strigidae\nDove - Columbidae\nEagle - Accipitridae\n\nAdditionally, each species object should contain another object named 'characteristics', with t... | 9 | 9 |
[
{
"content": "I am using [xlsx](https://www.npmjs.com/package/xlsx) to prepare the excel workbook through AWS lambda. I need to read the workbook from S3 and add the multiple sheets. I am using below code to read the excel workbook from S3 but final workbook size is too large.\n`xlsx.read(buffer, { cellStyles: ... | [
{
"content": "I am using [xlsx](https://www.npmjs.com/package/xlsx) to prepare the excel workbook through AWS lambda. I need to read the workbook from S3 and add the multiple sheets. I am using below code to read the excel workbook from S3 but final workbook size is too large.\n`xlsx.read(buffer, { cellStyles: ... | 9 | 9 |
[
{
"content": "Design a JavaScript program that collects humidity data for seven consecutive days from an external API. Once data is gathered, format it to display the information by the day of the week and the corresponding humidity. Also, incorporate error handling to deal with potential occurrences such as mi... | [
{
"content": "Design a JavaScript program that collects humidity data for seven consecutive days from an external API. Once data is gathered, format it to display the information by the day of the week and the corresponding humidity. Also, incorporate error handling to deal with potential occurrences such as mi... | 9 | 3 |
[
{
"content": "Develop a web crawler in JavaScript to index and search web pages.",
"role": "user"
},
{
"content": "Implementing a full-fledged web crawler in JavaScript isn't possible due to space limitations and complexity of the task. However, I can give a basic node.js program using axios and che... | [
{
"content": "Develop a web crawler in JavaScript to index and search web pages.",
"role": "user"
},
{
"content": "Implementing a full-fledged web crawler in JavaScript isn't possible due to space limitations and complexity of the task. However, I can give a basic node.js program using axios and che... | 9 | 2 |
[
{
"content": "Create a JavaScript function that takes two positive integers as arguments. The function should return an array of the first 'n' prime numbers that are larger than the first input integer, but exclude those that are multiples of 3. Additionally, optimize your function to handle large inputs effici... | [
{
"content": "Create a JavaScript function that takes two positive integers as arguments. The function should return an array of the first 'n' prime numbers that are larger than the first input integer, but exclude those that are multiples of 3. Additionally, optimize your function to handle large inputs effici... | 9 | 9 |
[
{
"content": "Develop a JavaScript loop that not only identifies the prime numbers within an array, but also outputs these prime values in a descending sequence. The array to be used is as follows: arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].",
"role": "user"
},
{
"content": "Here is a JavaScript function... | [
{
"content": "Develop a JavaScript loop that not only identifies the prime numbers within an array, but also outputs these prime values in a descending sequence. The array to be used is as follows: arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].",
"role": "user"
},
{
"content": "Here is a JavaScript function... | 7 | 7 |
[
{
"content": "Compose a JS code that segregates names of fruits and names of animals into separate arrays from a mixed array, and display each array in alphabetical order.\nlet items = [\"Cat\", \"Apple\", \"Elephant\", \"Rabbit\", \"Banana\", \"Fox\", \"Orange\"]",
"role": "user"
},
{
"content": "H... | [
{
"content": "Compose a JS code that segregates names of fruits and names of animals into separate arrays from a mixed array, and display each array in alphabetical order.\nlet items = [\"Cat\", \"Apple\", \"Elephant\", \"Rabbit\", \"Banana\", \"Fox\", \"Orange\"]",
"role": "user"
},
{
"content": "H... | 6 | 6 |
[
{
"content": "Create a JavaScript program to convert various date formats, provided as an array of strings, into MM/DD/YYYY. Your program should be able to handle a wide variety of input formats, including but not limited to: \"October 5, 2020\", \"5th October 2020\", \"2020.10.05\", \"2020-10-05\", \"2020/Oct/... | [
{
"content": "Create a JavaScript program to convert various date formats, provided as an array of strings, into MM/DD/YYYY. Your program should be able to handle a wide variety of input formats, including but not limited to: \"October 5, 2020\", \"5th October 2020\", \"2020.10.05\", \"2020-10-05\", \"2020/Oct/... | 6 | 6 |
[
{
"content": "Calculate the sum of 3, 5, 7, and 17 using JavaScript, but also create a function that can handle negative numbers and floating point values with up to 3 decimal places.",
"role": "user"
},
{
"content": "In JavaScript, you can simply add numbers using the '+' operator. But since we nee... | [
{
"content": "Calculate the sum of 3, 5, 7, and 17 using JavaScript, but also create a function that can handle negative numbers and floating point values with up to 3 decimal places.",
"role": "user"
},
{
"content": "In JavaScript, you can simply add numbers using the '+' operator. But since we nee... | 6 | 6 |
[
{
"content": "Construct a JavaScript object that executes a set of operations based on a series of provided conditional circumstances. These operations should follow a specific sequence depending on the outcome of each condition. These conditions must also serve as validation checks, returning relevant error me... | [
{
"content": "Construct a JavaScript object that executes a set of operations based on a series of provided conditional circumstances. These operations should follow a specific sequence depending on the outcome of each condition. These conditions must also serve as validation checks, returning relevant error me... | 6 | 1 |
[
{
"content": "Could you elaborate on a reliable technique to operationalize an AJAX callback function, ensuring it skillfully retrieves and meticulously organizes data derived from an elaborate HTML5 structured internet interface, while also judiciously managing to avoid overwhelming system resources?",
"ro... | [
{
"content": "Could you elaborate on a reliable technique to operationalize an AJAX callback function, ensuring it skillfully retrieves and meticulously organizes data derived from an elaborate HTML5 structured internet interface, while also judiciously managing to avoid overwhelming system resources?",
"ro... | 9 | 9 |
[
{
"content": "Write a function in JavaScript that not only generates a new HTML page with a given title tag, but also accepts additional parameters for adding a specified number of paragraphs and headers on the page. The paragraph contents and header texts should also be parameters of the function. Make sure ea... | [
{
"content": "Write a function in JavaScript that not only generates a new HTML page with a given title tag, but also accepts additional parameters for adding a specified number of paragraphs and headers on the page. The paragraph contents and header texts should also be parameters of the function. Make sure ea... | 9 | 9 |
[
{
"content": "Given a two-dimensional array of strings, implement a JavaScript function to filter out all elements that are not palindromes. The function should be case-insensitive and ignore whitespace, punctuation, and special characters.\n\nFor example, given the following input: [[\"a\", \"!race car?\"], [\... | [
{
"content": "Given a two-dimensional array of strings, implement a JavaScript function to filter out all elements that are not palindromes. The function should be case-insensitive and ignore whitespace, punctuation, and special characters.\n\nFor example, given the following input: [[\"a\", \"!race car?\"], [\... | 9 | 9 |
[
{
"content": "Propose an advanced JavaScript programming snippet that dynamically captures and displays all console log outputs from a generated random chunk of code, from the eighth log through the sixteenth log. Ensure the implementation also caters for potential undefined or error logs within the specified r... | [
{
"content": "Propose an advanced JavaScript programming snippet that dynamically captures and displays all console log outputs from a generated random chunk of code, from the eighth log through the sixteenth log. Ensure the implementation also caters for potential undefined or error logs within the specified r... | 7 | 7 |
[
{
"content": "Devise a regular expression, utilizing JavaScript's syntax, to ascertain whether a provided string contains an IEEE 754 floating-point number. Additionally, write a function to parse the string and determine if it falls within the range of a 32-bit signed integer (-2,147,483,648 to 2,147,483,647).... | [
{
"content": "Devise a regular expression, utilizing JavaScript's syntax, to ascertain whether a provided string contains an IEEE 754 floating-point number. Additionally, write a function to parse the string and determine if it falls within the range of a 32-bit signed integer (-2,147,483,648 to 2,147,483,647).... | 6 | 4 |
[
{
"content": "Construct a function using recursion instead of a for loop, employing ES6 syntax in JavaScript. This function should find and return the kth smallest element in an unsorted array of distinct integers. Consider edge cases in your solution.",
"role": "user"
},
{
"content": "Here is a Jav... | [
{
"content": "Construct a function using recursion instead of a for loop, employing ES6 syntax in JavaScript. This function should find and return the kth smallest element in an unsorted array of distinct integers. Consider edge cases in your solution.",
"role": "user"
},
{
"content": "Here is a Jav... | 8 | 8 |
[
{
"content": "Construct a JavaScript application that dynamically modifies the web navigation interface in accordance with individual user's history preferences. The application should have the capability to handle multiple user profiles simultaneously.\n\nAdd complexity by including the following features:\n\n... | [
{
"content": "Construct a JavaScript application that dynamically modifies the web navigation interface in accordance with individual user's history preferences. The application should have the capability to handle multiple user profiles simultaneously.\n\nAdd complexity by including the following features:\n\n... | 6 | 6 |
[
{
"content": "Create a JavaScript function that not only searches an element in a given sorted array, but also handles a series of queries efficiently by implementing a binary search algorithm. The function should return the index of the searched element if found, else return -1. Additionally, incorporate error... | [
{
"content": "Create a JavaScript function that not only searches an element in a given sorted array, but also handles a series of queries efficiently by implementing a binary search algorithm. The function should return the index of the searched element if found, else return -1. Additionally, incorporate error... | 9 | 2 |
[
{
"content": "Implement the bubble sort algorithm in JavaScript that not only sorts an array of integers in descending order but also calculates the run-time complexity. Now, your task is to modify the algorithm to sort a 2-dimensional array (an array of arrays) using bubble sort in descending order considering... | [
{
"content": "Implement the bubble sort algorithm in JavaScript that not only sorts an array of integers in descending order but also calculates the run-time complexity. Now, your task is to modify the algorithm to sort a 2-dimensional array (an array of arrays) using bubble sort in descending order considering... | 7 | 7 |
[
{
"content": "Write a function in JavaScript that takes a given multi-dimensional array and prints the elements in reverse order. Further, the elements of the inner arrays should also be reversed. If there are any nested arrays within these arrays, those should also be handled and their elements reversed. Your ... | [
{
"content": "Write a function in JavaScript that takes a given multi-dimensional array and prints the elements in reverse order. Further, the elements of the inner arrays should also be reversed. If there are any nested arrays within these arrays, those should also be handled and their elements reversed. Your ... | 9 | 3 |
[
{
"content": "Refine the following code:\n\n/*The Fib5 number sequence is defined as: fib5(0) -> 0, fib5(1) -> 0, fib5(2) -> 2, fib5(3) -> 0, fib5(4) -> 1, fib5(n) -> fib5(n-1) + fib5(n-2) + fib5(n-3) + fib5(n-4) + fib5(n-5). Write a dynamic programming function to compute the n-th element of this sequence, eff... | [
{
"content": "Refine the following code:\n\n/*The Fib5 number sequence is defined as: fib5(0) -> 0, fib5(1) -> 0, fib5(2) -> 2, fib5(3) -> 0, fib5(4) -> 1, fib5(n) -> fib5(n-1) + fib5(n-2) + fib5(n-3) + fib5(n-4) + fib5(n-5). Write a dynamic programming function to compute the n-th element of this sequence, eff... | 6 | 6 |
[
{
"content": "Write JavaScript code that not only identifies the object with the maximum number of properties within an array of objects, but also returns the cumulative quantity of those properties. If two or more objects have the same maximum number of properties, return them all. Moreover, code should handle... | [
{
"content": "Write JavaScript code that not only identifies the object with the maximum number of properties within an array of objects, but also returns the cumulative quantity of those properties. If two or more objects have the same maximum number of properties, return them all. Moreover, code should handle... | 6 | 6 |
[
{
"content": "Revise the following code:\n\n/*\n Write a function that sorts the given list of integers in decreasing order of the absolute value of digits. If multiple numbers share the same absolute value, they should be sorted in the reverse order of their original arrangement.\n Additionally, the revise... | [
{
"content": "Revise the following code:\n\n/*\n Write a function that sorts the given list of integers in decreasing order of the absolute value of digits. If multiple numbers share the same absolute value, they should be sorted in the reverse order of their original arrangement.\n Additionally, the revise... | 8 | 8 |
[
{
"content": "show me the javascript adaptation of this:\nclass LessThanTwoEvenDigits(Exception):\n pass\n\ndef second_highest_even_element(l: list):\n even_numbers = [x for x in l if x % 2 == 0]\n if len(even_numbers) < 2:\n raise LessThanTwoEvenDigits(\"The list has less than two even digits!\... | [
{
"content": "show me the javascript adaptation of this:\nclass LessThanTwoEvenDigits(Exception):\n pass\n\ndef second_highest_even_element(l: list):\n even_numbers = [x for x in l if x % 2 == 0]\n if len(even_numbers) < 2:\n raise LessThanTwoEvenDigits(\"The list has less than two even digits!\... | 9 | 9 |
[
{
"content": "Develop a fundamental middleware system using Express.js, with a particular focus on handling an HTTP POST request. This task demands a systematic investigative method to examine and formulate a response. The response should be embedded within a JSON (JavaScript Object Notation) data structure, th... | [
{
"content": "Develop a fundamental middleware system using Express.js, with a particular focus on handling an HTTP POST request. This task demands a systematic investigative method to examine and formulate a response. The response should be embedded within a JSON (JavaScript Object Notation) data structure, th... | 7 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.