GoConqr has a new look! Let us know what you think.

Flashcards

Javascript basics 2

James Drummond Javascript A-Level English 10 cards

Cards in this deck (10)

  1. 1How do you test something against a regex?var str = 'mystring';
    /[^a-zA-Z0-9]/.test( str );
    // Tests if string is alphanumeric
  2. 2How do you test a string against a regex?var str = 'mystring';
    str.match(/[^a-zA-Z0-9]/);
    // Tests if string is alphanumeric
  3. 3How do you convert a string to lower case?var str = 'This Is A StrinG';
    var lowerCase = str.toLowerCase();
  4. 4How do you trim whitespace from a string?var trimmedString = ' This is a string with whitespace '.trim();
  5. 5How do you iterate over an object in Javascript?for (var prop in obj){
    }
  6. 6Is the order of the keys in an ordinary object guaranteed?No
  7. 7How do you test if something is a function?if (typeof obj === 'function')
  8. 8What is the best way to round a number to two decimal placesMath.round(value*100)/100
    - works better than toFixed()
  9. 9var a = { name : 'james' } var b = a; b.name = 'Anna' What is a.name?a.name is Anna. Javascript assignment is by reference: both variables point to the same object.
  10. 10How do you copy an object in ES6?var b = Object.assign({}, b)

Information

Description
A-Level Javascript Flashcards on Javascript basics 2, created by James Drummond on 18/12/2015.
Created by
James Drummond
Views
2
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?