Coding Test: Find out the longest word from Given String

Challenge: You have given a string. Find out the longest word from that string.


Input: This is not the test123.

output: test123.

Sample Code:

function longestword(string) {

var arr = string.match(/[a-z0-9]+/gi);

var a = "";

for (let i = 0; i < arr.length; i++) {

if (a.length < arr[i].length) {

a = arr[i];



return a;


Try It yourself:


Another Solution:

function LongestWord(string) {

var arr = string.match(/[a-z0-9]+/gi);

var sorted = arr.sort(function (a, b) {

return b.length - a.length;


return sorted[0];


LongestWord("the $$$longest# word is coderbyte");


Drush Commands : How to create feature in drupal

I’m going to explain how to create feature in drupal using drush commands. It is easy and recommended way to update codebase for configuration changes.

Here I’ve made example how to create , update or revert feature either from command line

We usually create new configuration, add fields through Drupal Admin UI,

For example:  If you have page content type and you’ll need to add another field for meta description. You can easily go into Admin UI and add new field.

After adding through UI , we can include it in our code base by using drush commands and deploy to live site which will then automatically update without going and change into UI.

Continue reading

Posted in Uncategorized