bind() method creates a new function, when called has its this keyword set to the provided value Let’s have a look at a sample code, on how to use the bind() function: const person = { age: 20, getAge: function() { return this.age; } } const unBoundedGetAge = person.getAge; console.log(unBoundedGetAge()) If we run the code,… Read more »
Posts Categorized: JavaScript
call() function in JavaScript
call() or Function.prototype.call() method calls a function with a given this value and arguments. Let’s have a look at an example how to use call() method: function Product(name, price) { this.name = name; this.price = price; } function Food(name, price) { Product.call(this, name, price); this.category = ‘food’; } console.log(new Food(‘cheese’, 5).name); Output: cheese apply() or… Read more »
Cypress vs. TestCafe – Pros and Cons
Creating automated tests for your website, web application or mobile application was never an easy task. Have a look how to get started with Cypress in less than 30 minutes. Most of the companies started using Selenium WebDriver for test automation, which was a game changer 5-7 years ago when it first started getting traction,… Read more »
Selenium vs. Cypress: Which Software Testing Tool to Use?
Selenium is one of the most used, if not the most, automation software testing tool in the market today. It has a long history starting with 2004, with Selenium IDE, Selenium RC and now Selenium WedDriver. Cypress Automation Testing tool is a newer tool, appeared in 2014, and had a huge rewrite couple of years… Read more »
Cypress.io 4.0 supports Firefox and Edge browsers
Cypress.io announced that with v4.0, Mozilla Firefox and Microsoft Edge (Chromium based) browsers are supported. Have a look how to get started with Cypress in less than 30 minutes. This update is quite huge for the software testing community, since the other competitor of Cypress.io, TestCafe was supporting Firefox and Edge browsers for a while… Read more »
‘use strict’ in JavaScript
When to add ‘use strict’ in JavaScript and what implications implies. If you don’t use ‘use strict’, the context of this will be the global window object. function getName() { console.log(this) } getName() When using strict mode, the context of this inside a function on the global context will be undefined: ‘use strict’ function getName()… Read more »