Appearance
question:Create an HTML form with two inputs, one to enter a first name and another to enter a last name.
answer:<form> <label>First name:</label> <input type="text" name="firstname" /> <br><br> <label>Last name:</label> <input type="text" name="lastname" /> <br><br> <input type="submit" value="Submit" /> </form>
question:Write a JavaScript program to create a random string of 10 characters.
answer:function getRandomString() { var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; var randomstring = ''; for (var i=0; i<10; i++) { var rnum = Math.floor(Math.random() * chars.length); randomstring += chars.substring(rnum,rnum+1); } return randomstring; }
question:Design a basic color palette for a website with five colors.
answer:A basic color palette for a website could consist of the following colors: white (#FFFFFF), black (#000000), navy blue (#000080), beige (#F3F3F3), and light blue (#AFEBE6).
question:Use the .filter() function to find all even numbers from an array of numbers: [3, 5, 10, 7, 8, 11]. [3, 5, 10, 7, 8, 11]
answer:[3, 5, 10, 7, 8, 11].filter(x => x % 2 == 0) // Output: [10, 8]