Skip to content

Instantly share code, notes, and snippets.

@tgkprog
Last active August 24, 2020 15:05
Show Gist options
  • Save tgkprog/8ccfee9d03db3479f88eb1bd8c660932 to your computer and use it in GitHub Desktop.
Save tgkprog/8ccfee9d03db3479f88eb1bd8c660932 to your computer and use it in GitHub Desktop.
On camera need to take 2-3 screen shots of face and then can switch off
Share your screen
Do not seach the internet for specifcally searching for this question, but can use if required for JS arrays/ loops. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration ; https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for ; https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
Extra marks if you can make input - one text box and button (simple validation is number >0 and <20) and output in a div it appear on a HTML page like in https://sel2in.com/pages/prog/html/js2/Zawgyi.html
Use Vanilla Javascrpt no frameworks.
Given n>=0, create an array length n*n with the following pattern, shown here for n=3 : {0, 0, 1, 0, 2, 1, 3, 2, 1} (spaces added to show the 3 groups).
squareUp(3) -> [0, 0, 1, 0, 2, 1, 3, 2, 1]
squareUp(2) -> [0, 1, 2, 1]
squareUp(4) -> [0, 0, 0, 1, 0, 0, 2, 1, 0, 3, 2, 1, 4, 3, 2, 1]
Make use of multiple functions. Keep vaidation, actual work, rendering on screen in seprarate functions
function squareUp(n) {
}
Also make test case helper and test cases like https://raw.githubusercontent.com/tgkprog/codingbat/master/src/org/moh/academic/IcyHot.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment