Textarea Javascript Condition

Hi Team,

I have a text area. Need to incorporate 2 conditions written in javascript

  1. Should accept only max 40 characters per line
  2. User should not be allowed to key more than 5 lines.
    User will key address without pressing enter once keying in 5th line ends it should not accept text further.
    Should accept minimum 1 character per line also but should not allow the user to key more than 5 lines
    Any sample code would be of great help. Thanks