Note: Please test your output on the console and also avoid the functions below.






6. Write a function which combines two strings which are passed as 7. The trimLeft) method remove...
JavaScript 1. Write a function which receives one argument (string) and converts the string to uppercase. function('abc') // returns 'ABC' 2. Write a function that accepts an array and a value. Find and return the first array element with bigger than given value. function([5,15,4],6) //returns 15 DO NOT USE THESE IN-BUILT FUNCTIONS BELOW endsWith() includes() indexOf() lastIndexOf() localeCompare() match() repeat() replace() search() slice() split() startsWith() substr() substring() toLocaleLowerCase() toLocaleUpperCase() toLowerCase() toString() toUpperCase() trim() valueOf() trimLeft and trimRight unshift() valueOf() includes()...
Code the following function in JAVASCRIPT (Use of the given
list of inbuilt functions is not allowed)
Write a function that searches the string (passed
as first argument) for the character (passed as second argument)
and changes the case for all instances of that char found in
string. The function should return the new string as shown in
example below: function(‘abRA’, ‘a’) // returns
‘AbRa’
Assignment-2(2).pdf + х A file:///C:/Users/bhati/OneDrive/Desktop/Assignment-2(2).pdf 5 of 6 O + Fit to page IL Page...
CODE THE FOLLOWING FUNCTIONS IN JAVASCRIPT (USE OF THE
ABOVE MENTIONED IN BUILT FUNCTIONS IS NOT ALLOWED)
Write a function that accepts an array as argument. The function
should loop through the array elements and accumulate the sum of
ASCII value of each character in element and return the total. For
example: function([‘A’, ‘bc’, 12]); // returns 361 which is the sum
of 65 + 98 + 99 + 49 + 50
Write a function that accepts two arguments (a...
Java Programming Write a function which is passed two strings. The function creates a new string from two original strings by copying one character from each in turn until all characters have been copied. No use of scanner, hashmap, or exceptions please.
Write a recursive function called abb pattern with a single parameter astr, which is a string. The function returns True if astr is a string of the form a nb 2n (n a-s followed by 2n b-s, where n is a positive integer) and False otherwise. For example, abb pattern("abb"), abb pattern("aabbbb"), and abb pattern("aaaabbbbbbbb") all return True, but abb pattern("") (parameter is an empty string), abb pattern("abbabb"), and abb pattern("aaabbbbb") all return False. you may not use any built-in...
You are to write two functions, printString() and testString(), which are called from the main function. printString (string) prints characters to std::cout with a space after every character and a newline at the end. testString (string) returns true if the string contains two consecutive characters that are the same, false otherwise. See the main() to see how the two functions are called. Some sample runs are given below: string: “hello” printString prints: h e l l o testString returns: true...
Write two (2) overloaded functions that find a string in another string (first function) and find an integer in an integer array (second function). These should be value returning functions that return: For the string find, the string value if found, “not found” if the string is not found. For the integer file, the value if found or -1 if not found. The string function will pass in a string to find and the containing string, e.g. the request could...
this needs to be in Java:
use a comparator class which
is passed into the sort method that is available on the
ArrayList.
import java.util.Scanner;
public class Assign1{
public static
void main(String[] args){
Scanner reader = new Scanner (System.in);
MyDate todayDate = new MyDate();
int choice = 0;
Library library = new Library();
while (choice != 6){
displayMainMenu();
if (reader.hasNextInt()){
choice = reader.nextInt();
switch(choice){
case 1:
library.inputResource(reader, todayDate);
break;
case 2:
System.out.println(library.resourcesOverDue(todayDate));
break;
case 3:
System.out.println(library.toString());
break;
case 4:
library.deleteResource(reader,...
Using swift 4.0, Write a function (not method) named findName which returns a given name (passed as a parameter) if it is in the string array passed as a parameter, otherwise return nil Demonstrate calling the function findName. Using swift 4.0