Tagged: javascript

0

what does console.log.bind(console) do?

Function#bind allows you to create a new function, whose this value will be set to the value you pass.   Hence, it allows you to abstract the console.log statements. So, you can type : var...

0

Add / Push Characters to string in Javascript

[et_pb_section admin_label=”section”][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” text_text_color=”#000000″ use_border_color=”off” border_color=”#ffffff” border_style=”solid”] var a  = ‘wxy’; a = a.concat(‘z’); console.log(a); // wxyz [/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]

0

Print nodes at k level from the root in a binary tree

[et_pb_section admin_label=”section”][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid”] Given a binary tree, level k, print all the nodes at level k. For example, 4, 7, 8 are at level 2.   1...

0

currying : javascript interview question

[et_pb_section admin_label=”section”][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” text_text_color=”#000000″ use_border_color=”off” border_color=”#ffffff” border_style=”solid”] Currying is a useful technique, with which you can partially evaluate functions.   One of the most basic example of the currying is...

0

Dedupe an array in javascript

Input : An array Output : An array Logic : Iterate over the input array called data Add the element to the output array called result if the element does not exist in the...

0

Implement a debounce function in javascript

Problem description : Implement a debounce function. For example, you wanted the mousmove function to be called only after 2 seconds has passed between mouse move events. A debounce function limits the rate at...

Show Buttons
Hide Buttons