Jump to content

Mxlt

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Mxlt

  1. Hi! I was going through the JavaScript Tutorial but I bumped into this code that got me so confused...if anybody could explain it to me I would really appreciate it! I am specially confused with the prototype thing, and then those weird codes: after the replace. <!DOCTYPE html> <html> <body> <h2>JavaScript String.trim()</h2> <p>IE 8 does not support String.trim(). To trim a string you can use a polyfill.</p> <script> if (!String.prototype.trim) { String.prototype.trim = function () { return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); }; var str = " Hello World! "; alert(str.trim()); </script> </body> </html>
  2. Hi! I need some help with an exercise I am doing. In my exercise, the borders on the right side is taking too much space, I would like it to take only as much space as it needs, with only around 2em of padding, but for some reason, the left side and the upper side seems to have a lot of space....I would appreciate a lot if you could help me. Attached you can find the file and here is a link with the exercise I am doing (the first one). Exercises Thank you! Ejercicio1prueba.htm
×
×
  • Create New...