question archive In Javascript : Q4
Subject:Computer SciencePrice: Bought3
In Javascript :
Q4. Write a function that takes two strings and returns the string which has more words in it. Remember not
alphabets, Words.
Example: function functionName('This is the larger string in this case', 'I am another string') will return
'This is the larger string in this case' because it has 8 words in it compared to 4 on the other string.
Q5. Write a function which takes an object as an argument. It checks if the object contains name property. If
name
property exists it adds hasName property in the object as true, otherwise adds hasName property as false.
It should also remove name property from the object and return the new object.